> what i am looking is extract from the input file 100 PO's . as i > told first 10 bytes of the file is the PO number and each PO can > contain one record or > multiple records. The idea is to extract 100 PO with the all the PO > related information which resides in multiple records.
Ron, This is yet another simple exercise. Here is a JCL that you can copy paste which will give you the desired results. Here I am showing an input file with 8 different po's and I am picking the first 5 PO's I used Symbols for the number of PO's to be picked, so that you don't have to change the control cards all the time. I assumed that your DATA is already SORTED on the PO number in the first 11 bytes. If it is not then add a SORT statement to sort the PO's and change the INREC to OUTREC. // EXPORT SYMLIST=* // SET NUMPO=5 //* //STEP0100 EXEC PGM=SORT //SYSOUT DD SYSOUT=* //SORTIN DD * 102016 | 31859949 | | 1613QTTR | 1 102016 | 31859949 | | 1613QTTR | 1 102016 | 31859949 | | 1613QTTR | 1 102016 | 31859949 | | 1613QTTR | 1 102016 | 31859949 | | 1613QTTR | 1 102016 | 31859949 | | 1613QTTR | 1 102016 | 31859949 | | 1613QTTR | 1 102016 | 31859949 | | 1613QTTR | 1 104152 | 32412273 | | 2373QTBO | 1 104152 | 32412273 | | 2373QTBO | 1 104152 | 32412273 | | 2373QTBO | 1 104152 | 32412273 | | 2373QTBO | 1 104152 | 32412273 | | 2373QTBO | 1 104153 | 32412273 | | 2373QTBO | 1 104153 | 32412273 | | 2373QTBO | 1 104154 | 32412273 | | 2373QTBO | 1 104154 | 32412273 | | 2373QTBO | 1 104154 | 32412273 | | 2373QTBO | 1 104155 | 32412273 | | 2373QTBO | 1 104156 | 32412273 | | 2373QTBO | 1 104156 | 32412273 | | 2373QTBO | 1 104157 | 32412273 | | 2373QTBO | 1 104158 | 32412273 | | 2373QTBO | 1 //SORTOUT DD SYSOUT=* //SYSIN DD *,SYMBOLS=JCLONLY OPTION COPY INREC IFTHEN=(WHEN=GROUP,KEYBEGIN=(1,11),PUSH=(5001:ID=8)) OUTFIL BUILD=(1,5000), INCLUDE=(5001,8,UFF,LE,&NUMPO) //* The output from this job is 102016 | 31859949 | | 1613QTTR | 1 102016 | 31859949 | | 1613QTTR | 1 102016 | 31859949 | | 1613QTTR | 1 102016 | 31859949 | | 1613QTTR | 1 102016 | 31859949 | | 1613QTTR | 1 102016 | 31859949 | | 1613QTTR | 1 102016 | 31859949 | | 1613QTTR | 1 102016 | 31859949 | | 1613QTTR | 1 104152 | 32412273 | | 2373QTBO | 1 104152 | 32412273 | | 2373QTBO | 1 104152 | 32412273 | | 2373QTBO | 1 104152 | 32412273 | | 2373QTBO | 1 104152 | 32412273 | | 2373QTBO | 1 104153 | 32412273 | | 2373QTBO | 1 104153 | 32412273 | | 2373QTBO | 1 104154 | 32412273 | | 2373QTBO | 1 104154 | 32412273 | | 2373QTBO | 1 104154 | 32412273 | | 2373QTBO | 1 104155 | 32412273 | | 2373QTBO | 1 >>>I'd use three steps. The first step would sort the data by PO number which would output the lowest 100 PO numbers. See SAMPLE= if you want to take every "n"th record. The second step would be REXX to create the SORT control cards for the next step. And the last step would be SORT to extract the selected PO numbers. John, You don't need 3 steps, It is pretty simple as shown above. DFSORT has wide variety of functions to extract data like this Thanks, Kolusu DFSORT Development IBM Corporation ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN