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

write particular julian date of the month in header


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

New User


Joined: 13 Nov 2007
Posts: 3
Location: india

PostPosted: Mon Jan 23, 2012 2:12 am
Reply with quote

Hi,

Currently we populate the current julian date to the header with the below code
OPTION COPY
OUTFIL REMOVECC,
HEADER1=('H',X,YDDDNS=(4D))

The job A ran on Jan 11th 2012
Current header record of output file:
H 2012011

New requirement:
--------------------
The output file header record should be written with current month 15th julian date irrespective of the current date of job execution.

For example :
Scenario -1
If my job A runs on Jan 20th 2012, then the output file header should have Jan 15th 2012 julian date (2012015)

Scenario -2
If my job A runs on Feb 8th 2012, then the output file header should have Feb 15th 2012 julian date (2012046)

Please let me know how can we achieve this?

Thanks,
Ruben
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: Mon Jan 23, 2012 6:16 am
Reply with quote

A solution, using the generation of a SYMNAME for the modified date, thus requiring one extra step, but not reading any particular data.

I couldn't get the system date in, day changed to 15 and the date conversion done in one OVERLAY or BUILD within a reasonable amount of time. Doesn't mean it can't be done...

Code:
//SYMNGEN EXEC PGM=SORT
//SYSIN DD *
                                                                   
 OPTION COPY,STOPAFT=1
                                                                   
 OUTFIL IFOUTLEN=80,
        IFTHEN=(WHEN=INIT,BUILD=(C'HEADER-DATE,C''',DATE1)),
        IFTHEN=(WHEN=INIT,OVERLAY=(21:C'15',
                                   15:15,8,Y4T,TOJUL=Y4T,C''''))
                                                                   
//SYSOUT DD SYSOUT=*
//SORTOUT DD DSN=&&SYM,SPACE=(TRK,1),DISP=(,PASS),UNIT=SYSDA
//SORTIN DD *
The sortin for this step could be any dataset you like, as long as it is F and has
at least one record. If it has more than one, the STOPAFT=1 will stop it causing problems
//HEADADD EXEC PGM=SORT
//SYMNAMES DD DSN=&&SYM,DISP=(OLD,PASS)
//SYMNOUNT DD SYSOUT=*
//SYSIN DD *
                                                                   
  OPTION COPY
  OUTFIL REMOVECC,
  HEADER1=('H',X,HEADER-DATE)
                                                                   
//SYSOUT DD SYSOUT=*
//SORTOUT DD SYSOUT=*
//SORTIN DD *
TEST1
TEST2
TEST3
TEST4
TEST5
TEST6


The symbol generated for the SYMNAMES DD in the next step (pasted from the output of the second step, where it is printed due to the SYMNOUT DD):

Code:

------- ORIGINAL STATEMENTS FROM SYMNAMES -------
HEADER-DATE,C'2012015'                           
                                                 
------------------ SYMBOL TABLE -----------------
HEADER-DATE,C'2012015'                           


The Sort cards from the second step, after symbol substitution, pasted from the sort output messages:

Code:
  OPTION COPY                               
 OUTFIL REMOVECC,HEADER1=('H',X,C'2012015')


The output:

Code:

H 2012015
TEST1   
TEST2   
TEST3   
TEST4   
TEST5   
TEST6   


I have tested it with other dates up to June this year.

Edit: Maybe the code does not use the IFTHENs: they were part of an "attempt" and they stayed for setting the output record-length to 80. Maybe instead an appropriate number of Xs could be used to get the length.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Mon Jan 23, 2012 10:16 pm
Reply with quote

ruben.d,

Assuming that your LRECL =80 and RECFM=FB, the following DFSORT JCL will give you the desired results
Code:

//STEP0100 EXEC PGM=SORT                             
//SYSOUT   DD SYSOUT=*                               
//SORTIN   DD *                                     
TEST1                                               
TEST2                                               
TEST3                                               
TEST4                                               
TEST5                                               
TEST6                                               
//SORTOUT  DD SYSOUT=*                               
//SYSIN    DD *                                     
  SORT FIELDS=COPY                                   
  OUTREC IFTHEN=(WHEN=INIT,OVERLAY=(81:DATE2,C'15')),
  IFTHEN=(WHEN=INIT,OVERLAY=(89:81,8,Y4T,TOJUL=Y4T))
                                                     
  OUTFIL REMOVECC,BUILD=(1,80),                     
  HEADER1=('H',X,89,7)                               
//*
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 Populate last day of the Month in MMD... SYNCSORT 2
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts Need to convert date format DFSORT/ICETOOL 20
Search our Forums:

Back to Top