IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Need to include date from the reference file to header


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
jegan_selvan

New User


Joined: 23 Oct 2006
Posts: 24
Location: India

PostPosted: Thu Apr 12, 2012 6:14 pm
Reply with quote

The input file has a record length of 80 FB (This will contain only detail records). I have another input file which has the date with format CCYYMMDD in the first position with record length 80 and FB.

My requirement is to add a header and trailer record as follows.

HDRCCYYMMDD
Detail record1
Detail record2
Detail record3
TRL00003

where CCYYMMDD ( Date from Reference file)
TRL will contain the count of detail record.

Regards,

Jegan S
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Apr 12, 2012 6:24 pm
Reply with quote

There is another requirement today that is looking to use a single-record file, Have a look for that to get your date available.

To create a header and a trailer, look at HEADER1 and TRAILER1 on OUTFIL. There are examples in the forum.
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 577
Location: USA

PostPosted: Thu Apr 12, 2012 7:26 pm
Reply with quote

jegan_selvan,

real quick without much of a testing, see if below helps...
Code:
//STEP0001     EXEC PGM=SORT                           
//SYSOUT   DD SYSOUT=*                                 
//SORTIN   DD *                                         
CCYYMMDD                                               
/*                                                     
//         DD *                                         
DETAIL RECORD1                                         
DETAIL RECORD2                                         
DETAIL RECORD3                                         
/*                                                     
//SORTOUT  DD  SYSOUT=*                                 
//SYSIN    DD *                                         
  INREC IFTHEN=(WHEN=GROUP,RECORDS=2,PUSH=(81:1,8))     
  OPTION COPY                                           
  OUTFIL REMOVECC,STARTREC=2,BUILD=(1,80),             
                  HEADER1=('HDR',81,8),                 
                 TRAILER1=('TRL',COUNT=(M11,LENGTH=05))
/*                                                     

OUTPUT
Code:
HDRCCYYMMDD   
DETAIL RECORD1
DETAIL RECORD2
DETAIL RECORD3
TRL00003     

Thanks,
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Apr 12, 2012 7:56 pm
Reply with quote

Or, to add when you've copied the code to generate the symbol/SYMNAMES:

Code:
//STEP0001     EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SORTIN   DD *
DETAIL RECORD1
DETAIL RECORD2
DETAIL RECORD3
/*
//SYMNAMES DD * replace this with your dsn and ditch the single line of data beneath
DATE-FROM-FILE,C'CCYYMMDD'
//SORTOUT  DD  SYSOUT=*
//SYSIN    DD *
  OPTION COPY
  OUTFIL REMOVECC,
                  HEADER1=('HDR',DATE-FROM-FILE),
                 TRAILER1=('TRL',COUNT=(M11,LENGTH=05))


Output is:

Code:
HDRCCYYMMDD   
DETAIL RECORD1
DETAIL RECORD2
DETAIL RECORD3
TRL00003     
Back to top
View user's profile Send private message
jegan_selvan

New User


Joined: 23 Oct 2006
Posts: 24
Location: India

PostPosted: Mon Apr 16, 2012 6:10 pm
Reply with quote

Hi All,

Thanks for your reply and it worked fine.

Regards,

Jegan S
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
Search our Forums:

Back to Top