Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Pass STARTREC & ENDREC - Syncsort

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Wed Oct 22, 2008 2:52 pm    Post subject: Pass STARTREC & ENDREC - Syncsort
Reply with quote

Hi,

We have a file (RECFM=FB & LRECL=300) with 2 lac records in it. I need to copy the records from particular number to particular number to output file (we can use STARTREC & ENDREC with OPTION COPY). But, the starting record should have "HDR" at column position 21 and ending record should have "TLR" at column position 31. So, I need to copy only the records between these.

My thought is like using INCLUDE with condition to search the file for "HDR" or "TLR" and passing on the record number to STARTREC and ENDREC respectively. I am not able to convert my idea into coding.

Please help.

Thanks.
Back to top
View user's profile Send private message

acevedo

Active User


Joined: 11 May 2005
Posts: 344
Location: Spain

PostPosted: Wed Oct 22, 2008 4:48 pm    Post subject:
Reply with quote

I'do it in 2 steps.

1-to get the SEQNUM associated to HDR and LTR (using INREC), the output would be the sysin to the second step.
OUTFIL STARTREC=positionofHDRhere,ENDREC=positionofLTRhere

2-sort with the previous sysin (+ option copy)

sure other members could achieved in one step.

hth
Back to top
View user's profile Send private message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Wed Oct 22, 2008 6:44 pm    Post subject: Reply to: Pass STARTREC & ENDREC - Syncsort
Reply with quote

Hi,

Based on your suggestions this is how I could write my job but unsuccessful icon_sad.gif

Code:

//STEP0101 EXEC PGM=SORT                                           
//SORTOUT  DD DSN=&&T1,DISP=(MOD,PASS,DELETE),SPACE=(TRK,(1,1),RLSE)
//SYSOUT   DD SYSOUT=*                                             
//SORTIN   DD *                                                     
ABCD1111                                                           
BCDE2222                                                           
CDEF3333                                                           
DEFG4444                                                           
EFGH5555                                                           
FGHI6666                                                           
GHIJ7777                                                           
HIJK8888                                                           
IJKL9999                                                           
JKL10000                                                           
/*                                                                 
//SYSIN    DD *                                                     
 OPTION COPY                                                       
 INREC BUILD=(1,8,10:SEQNUM,3,ZD)                                   
/*                                                                 
//STEP0102 EXEC PGM=SORT                                           
//SYSOUT   DD SYSOUT=*                                             
//SORTOUT  DD DSN=&&T2,DISP=(MOD,PASS,DELETE),SPACE=(TRK,(1,1),RLSE)
//SORTIN   DD DSN=&&T1,DISP=(MOD,DELETE,DELETE)                     
//SYSIN    DD *                                                     
 OPTION COPY                                                       
 INCLUDE COND=(5,4,ZD,EQ,2222,OR,5,4,ZD,EQ,8888)                   
 OUTFIL IFTHEN=(WHEN=(5,4,ZD,EQ,2222),                             
                BUILD=(2:C'OPTION COPY',/,                         
                       2:C'OUTFIL',X,C'STARTREC=',10,3,C',')),     
        IFTHEN=(WHEN=(5,4,ZD,EQ,8888),BUILD=(1:C'ENDREC=',10,3))   
/*             
//STEP0103 EXEC PGM=SORT                       
//SYSOUT   DD SYSOUT=*                         
//SORTOUT  DD SYSOUT=*                         
//SORTIN   DD *                               
ABCD1111                                       
BCDE2222                                       
CDEF3333                                       
DEFG4444                                       
EFGH5555                                       
FGHI6666                                       
GHIJ7777                                       
HIJK8888                                       
IJKL9999                                       
JKL10000                                       
//SYSIN    DD DSN=&&T2,DISP=(MOD,DELETE,DELETE)                                                   
/*


I am not able to understand why am getting all the 10 records into the output file where as it should be only 7.

The STEP0102 creates the temporary output file as given below:

Code:

 OPTION COPY         
 OUTFIL STARTREC=002,
ENDREC=008           


But when I look at the SYSOUT after completion of the job the SYSIN supplied to STEP0103 looks like this icon_confused.gif

Code:

SYSIN :                                             
 OPTION COPY          OUTFIL STARTREC=002,ENDREC=008
 OUTFIL STARTREC=002,ENDREC=008                     
ENDREC=008                                         


I have tried hard but could not fix it......

Any suggestions or alternatives please

Thanks.
Back to top
View user's profile Send private message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Wed Oct 22, 2008 7:04 pm    Post subject: Reply to: Pass STARTREC & ENDREC - Syncsort
Reply with quote

Ok......at last, I have achieved it (per my thinking).......

The SYSIN in STEP0102 has been modified to get through it...... icon_biggrin.gif

Code:

//SYSIN    DD *                                                   
 OPTION COPY                                                     
 INCLUDE COND=(5,4,ZD,EQ,2222,OR,5,4,ZD,EQ,8888)                 
 OUTFIL IFTHEN=(WHEN=(5,4,ZD,EQ,2222),                           
                BUILD=(2:C'OPTION COPY',77X,/,                   
                       2:C'OUTFIL',X,C'STARTREC=',10,3,C',',67X)),
        IFTHEN=(WHEN=(5,4,ZD,EQ,8888),BUILD=(2:C'ENDREC=',10,3)) 
/*                                                               


I request the SYNCSORT experts to fine tune this so that lots of junk can be removed....... icon_smile.gif

Thanks a lot to acevedo for giving the idea........ icon_cool.gif
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Wed Oct 22, 2008 9:22 pm    Post subject:
Reply with quote

For those of you who have DFSORT, you can do this kind of thing quite easily with the new WHEN=GROUP function available with z/OS DFSORT V1R5 PTF UK90013 (July, 2008).

Quote:
the starting record should have "HDR" at column position 21 and ending record should have "TLR" at column position 31. So, I need to copy only the records between these.


Here's the DFSORT job for this one:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (FB/300)
//SORTOUT DD DSN=..  output file (FB/300)
//SYSIN    DD    *
  OPTION COPY
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(21,3,CH,EQ,C'HDR'),
    END=(31,3,CH,EQ,C'TLR'),PUSH=(301:ID=1))
  OUTFIL INCLUDE=(301,1,CH,NE,C' '),BUILD=(1,300)
/*


Here's the DFSORT job for the 2222-8888 one:

Code:

//S2    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
ABCD1111
BCDE2222
CDEF3333
DEFG4444
EFGH5555
FGHI6666
GHIJ7777
HIJK8888
IJKL9999
JKL10000
/*
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
  OPTION COPY
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(5,4,ZD,EQ,2222),
    END=(5,4,ZD,EQ,8888),PUSH=(81:ID=1))
  OUTFIL INCLUDE=(81,1,CH,NE,C' '),BUILD=(1,80)
/*


For complete details on all of the new DFSORT and ICETOOL functions available with the July, 2008 PTF, see:

www.ibm.com/systems/support/storage/software/sort/mvs/ugpf/
Back to top
View user's profile Send private message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Wed Oct 22, 2008 9:58 pm    Post subject: Reply to: Pass STARTREC & ENDREC - Syncsort
Reply with quote

wow.......very useful and simplified..... icon_biggrin.gif

Thank you Frank.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SYNCSORT SEQNUM and FI fields. nartcr SYNCSORT 7 Sat Jan 21, 2017 4:02 am
No new posts Syncsort Help to group fields sudhakarraju SYNCSORT 6 Thu Dec 29, 2016 1:38 am
No new posts JES2 JEC: Use UNIX Pipes to Pass Data... Virendra Shambharkar JCL & VSAM 21 Tue Dec 20, 2016 6:55 pm
No new posts syncsort: copy lines after the keyword shreya19 SYNCSORT 7 Fri Dec 02, 2016 9:47 am
No new posts Syncsort - Hard coded Value in output PORYES SYNCSORT 1 Thu Nov 03, 2016 9:23 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us