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
 

 

Process records based on header conditional using Syncsort

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

Active User


Joined: 05 Jan 2007
Posts: 101
Location: chennai (India)

PostPosted: Tue Nov 29, 2011 7:39 pm    Post subject: Process records based on header conditional using Syncsort
Reply with quote

Hi,

I have an input file having header and Trailer records. Based on the date field condition in header i want to fetch its corresponding records in output.

The condition is if the date field in Header record is less than Current date (Date1) then write them into output file

Assume the file is of Fixed length and LRECL=80.

Input file:-
10 11102012SUB30023 ---> Header with date MMDDYYYY
20 TES1 DATA
30 TES2 DATA
40 TES3 DATA
50 TES4 DATA
99 TRAILER ---> Trailer
10 11102011SUB30024 ---> Header with date MMDDYYYY
20 TES1 DATA
30 TES2 DATA
40 TES3 DATA
50 TES4 DATA
99 TRAILER ---> Trailer

Output :-
10 11102011SUB30024 ---> Header with date MMDDYYYY
20 TES1 DATA
30 TES2 DATA
40 TES3 DATA
50 TES4 DATA
99 TRAILER ---> Trailer

Thanks
-3nadh
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Tue Nov 29, 2011 7:57 pm    Post subject: Reply to: Process records based on header conditional using
Reply with quote

"Current Date" as in system date? Never a good idea. Run it after midnihgt, or have to re-run from several weeks ago, and it will not "work" as you expect.
Back to top
View user's profile Send private message
xknight

Active User


Joined: 22 Jan 2008
Posts: 117
Location: Liberty city

PostPosted: Tue Nov 29, 2011 9:23 pm    Post subject:
Reply with quote

Hello,

Quote:
I have an input file having header and Trailer records. Based on the date field condition in header i want to fetch its corresponding records in output.

The condition is if the date field in Header record is less than Current date (Date1) then write them into output file


Any chance of multiple header-trailer in the input file
Back to top
View user's profile Send private message
bodatrinadh

Active User


Joined: 05 Jan 2007
Posts: 101
Location: chennai (India)

PostPosted: Tue Nov 29, 2011 11:05 pm    Post subject: Reply to: Process records based on header conditional using
Reply with quote

Each set of record has only 1 Header and one trailer record.
Here the requirement is i want to remove future date records... for example anydate comes after 11302011 ( MMDDYYYY).

Thanks
-3nadh
Back to top
View user's profile Send private message
xknight

Active User


Joined: 22 Jan 2008
Posts: 117
Location: Liberty city

PostPosted: Wed Nov 30, 2011 3:46 pm    Post subject:
Reply with quote

Hello,

Try this (Assumed MMDDYYYY starts from 4th position)

Code:
//STEP30 EXEC PGM=ICETOOL                                         
//DFSMSG   DD SYSOUT=*                                             
//TOOLMSG  DD SYSOUT=*                                             
//IN1      DD *                                                   
10 11102012SUB30023 ---> HEADER WITH DATE MMDDYYYY                 
20 TES1 DATA                                                       
30 TES2 DATA                                                       
40 TES3 DATA                                                       
50 TES4 DATA                                                       
99 TRAILER ---> TRAILER                                           
10 11302011SUB30024 ---> HEADER WITH DATE MMDDYYYY                 
20 TES1 DATA                                                       
30 TES2 DATA                                                       
40 TES3 DATA                                                       
50 TES4 DATA                                                       
99 TRAILER                                                         
//OUT1     DD DSN=&TMP1,                                           
//            DISP=(MOD,PASS,DELETE),                             
//            DCB=(RECFM=FB,LRECL=100,BLKSIZE=0),                   
//            SPACE=(CYL,(15,15),RLSE),UNIT=SYSDA                   
//OUT2     DD DSN=&TMP2,                                           
//            DISP=(MOD,PASS,DELETE),                               
//            DCB=(RECFM=FB,LRECL=100,BLKSIZE=0),                   
//            SPACE=(CYL,(15,15),RLSE),UNIT=SYSDA                   
//OUT3     DD SYSOUT=*                                             
//TOOLIN   DD *                                                     
  COPY FROM(IN1)  TO(OUT1) USING(CTL1)                             
  COPY FROM(OUT1) TO(OUT2) USING(CTL2)                             
  COPY FROM(OUT2) TO(OUT3) USING(CTL3)                             
/*                                                                 
//CTL1CNTL DD *                                                     
  SORT FIELDS=COPY                                                 
  INREC IFTHEN=(WHEN=(1,2,CH,EQ,C'10'),OVERLAY=(81:8,4,4,2,6,2))   
//CTL2CNTL DD *                                                     
  SORT FIELDS=COPY                                                 
  INREC IFTHEN=(WHEN=GROUP,                                         
        BEGIN=(1,2,CH,EQ,C'10',AND,81,8,CH,EQ,&DATE1),             
        END=(1,2,CH,EQ,C'99'),                                     
        PUSH=(90:ID=1))                                             
//CTL3CNTL DD *                               
  SORT FIELDS=COPY                           
  INCLUDE COND=(90,1,CH,EQ,C'1')             
  OUTREC BUILD=(1,80)

Please use code-tags for better understanding

You need to do,

Please change the OUT3 to your file name, which is pointing to sysout, with the file attributes

Note: Three passes can be reduced
Back to top
View user's profile Send private message
bodatrinadh

Active User


Joined: 05 Jan 2007
Posts: 101
Location: chennai (India)

PostPosted: Wed Nov 30, 2011 6:56 pm    Post subject: Reply to: Process records based on header conditional using
Reply with quote

Thanks Xavier for posting the code :-)

Thanks
-3nadh
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 How to add header with Date(YYMMDD) i... Rajan Moorthy DFSORT/ICETOOL 2 Thu Jul 06, 2017 11:44 pm
No new posts Check if any Detail records and extra... V S Amarendra Reddy SYNCSORT 19 Mon May 08, 2017 8:54 pm
No new posts Issue with NDM process to transmit ES... chetanambi All Other Mainframe Topics 6 Wed May 03, 2017 10:52 am
No new posts Group Data based on a key Arun Raj DFSORT/ICETOOL 7 Thu Apr 27, 2017 11:29 pm
No new posts Validating file with multiple header/... mohitsaini DFSORT/ICETOOL 6 Thu Apr 13, 2017 1:53 am


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