Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
write particular julian date of the month in header

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: write particular julian date of the month in header
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Mon Jan 23, 2012 6:16 am    Post subject: Reply to: write particular julian date of the month in heade
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL 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 write Rexx program to size and... sreejeshcs CLIST & REXX 14 Thu Oct 12, 2017 7:26 am
No new posts Compare yesterday's date to the one o... migusd SYNCSORT 11 Fri Sep 22, 2017 11:35 pm
No new posts Fetch Previous month & year in MM... girishb2 DFSORT/ICETOOL 3 Thu Sep 21, 2017 9:54 pm
No new posts Validate the Date girishb2 DFSORT/ICETOOL 9 Tue Sep 19, 2017 1:12 am
No new posts Julian Date to CICS ABSTTIME blayek CICS 3 Wed Aug 30, 2017 11:15 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us