I had Records in file Like this
Company Code
IBM 2
IBM 1
IBM 4
WIPRO 3
WIPRO 2
WIPRO 9
TCS 4
TCS 6
TCS 3

i want the record of every company with highest code How can
i do that?

Answers were Sorted based on User's Feedback



I had Records in file Like this Company Code IBM 2 IBM 1 IBM 4 WIPR..

Answer / sathish

//STEP1 EXEC PGM=SORT
//SORTIN DD *
IBM 2
IBM 1
IBM 4
WIPRO 3
WIPRO 2
WIPRO 9
TCS 4
TCS 6
TCS 3
//SORTOUT DD DSN=D362967.TEST.PS1,DISP=SHR
//SYSOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=(1,12,CH,D)
/*
//STEP1 EXEC PGM=SORT
//SORTIN DD DSN=D362967.TEST.PS1,DISP=SHR
//SORTOUT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=(1,5,CH,A)
SUM FIELDS=NONE
/*

Is This Answer Correct ?    6 Yes 2 No

I had Records in file Like this Company Code IBM 2 IBM 1 IBM 4 WIPR..

Answer / ram

SORT FIELDS=(2,5,CH,D)
DUPKEYS MAX=(13,1,ZD)

Is This Answer Correct ?    1 Yes 0 No

I had Records in file Like this Company Code IBM 2 IBM 1 IBM 4 WIPR..

Answer / sk

Sort the file in decrement order , the key of sort is
Company name and company code, and also use SUM FIELDS =
NONE , then it will remove the duplicates also

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More JCL Interview Questions

mainframe questions like basic&depth

0 Answers   TetraSoft,


Where & How Do You Code Identifier In Jcl?

0 Answers   IBM,


Hi, can we call catalog( say myproc } proc n times in jcl if so how please explain Thanks in advance

2 Answers   Cap Gemini,


what is a null indicator in db2?

5 Answers   Fiserv, IBM,


When cursor is not closed what is the error?

3 Answers   IBM,






Explain the purpose of dd * statement in jcl?

0 Answers  


When The Define Jcl Is Not Available, How Can You Get Information About A Vsam File's Organisation ?

0 Answers   IBM,


How to submit multiple jobs. These jobs are members in PDS. The second job should run if the first job runs successfully and so on.

1 Answers  


How to DEBUG a JCL?

9 Answers   Satyam,


I have many files which i am receiving from client everyday. I have one step for every file to check for empty or not. Here client gives 30 files i need to check for every file for empty or not and i need to perform 30 steps. Can I do it in single step. Dynamically i need to change the File name in my step.

0 Answers  


Explain about Internal Sort

1 Answers  


While using SORT FILES =NONE,XSUM I am getting error "ICE172A E XSUM IS NOT SUPPORTED - USE ICETOOL SELECT IF APPROPRIATE"..I want to write duplicate records a a serparte file..how i can do tht?

3 Answers   Steria,


Categories