View previous topic :: View next topic
Author
Message
Suresh Shankarakrishnan New User Joined: 11 Jul 2008Posts: 42 Location: USA
Using ICEMAN, the following statement gives year in YYYY format.
//SYMNAMES DD *
CUR_YEAR,S'&YR4'
Can the year(YYYY) be returned as 2009 between July 1, 2008 and December 31, 2008 (as July 1 is beginning of fiscal year 2009) ?
Back to top
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
What year would you want between Jan, 2008 and June, 2008?
What year would you want between Jan, 2009 and June, 2009?
Do you really need to check the month and day (e.g. Dec 31) or would just checking the month do as well (e.g. Dec)?
Back to top
Suresh Shankarakrishnan New User Joined: 11 Jul 2008Posts: 42 Location: USA
Frank,
1.What year would you want between Jan, 2008 and June, 2008?
Year 2008.
2. What year would you want between Jan, 2009 and June, 2009?
Year 2009
3. Between Jul, 2008 and Dec 2008, YYYY will be 2009.
4. Between Jul, 2009 and Dec 2009, YYYY will be 2010.
Do you really need to check the month and day (e.g. Dec 31) or would just checking the month do as well (e.g. Dec)?
Just checking the month (Dec) only will be enough.
thanks.
Back to top
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
You can use a DFSORT job like this to create the symbol you asked for:
Code:
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD *
DUMMY RECORD
/*
//SORTOUT DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//SYSIN DD *
OPTION COPY
INREC IFOUTLEN=80,
IFTHEN=(WHEN=INIT,BUILD=(DATE2)),
IFTHEN=(WHEN=(5,2,ZD,LE,06),
BUILD=(C'CUR_YEAR,''',1,4,C'''')),
IFTHEN=(WHEN=NONE,
BUILD=(C'CUR_YEAR,''',1,4,ZD,ADD,+1,EDIT=(TTTT),C''''))
/*
//S2 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS) Has CUR-YEAR symbol
//SORTIN DD DSN=... input file
//SORTOUT DD DSN=... output file
...
Back to top
Suresh Shankarakrishnan New User Joined: 11 Jul 2008Posts: 42 Location: USA
Frank,
From your example above, in the following code - does RECORD refer to the input record?
If so, can the 'system year'(YYYY) be taken as input (instead of input record/file), and then the logic to add 1 be applied (i.e. add 1 if month falls between July and December) ?
//SORTIN DD *
RECORD
/*
Back to top
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
No, RECORD in S1 is just a dummy record. We just need that one record (it can be anything) to create the DATE2 record of yyyymm so we can manipulate it.
The S2 step would have your actual input records.
I've modified the job to make that clearer.
Back to top
Suresh Shankarakrishnan New User Joined: 11 Jul 2008Posts: 42 Location: USA
Maybe I am missing something, but I get errors, let me try some more...please let me know.
Code:
DFSort version is '5694-A01, Z/OS DFSORT V1R5'
INREC IFOUTLEN=80,
$
ICE005A 0 STATEMENT DEFINER ERROR
IFTHEN=(WHEN=INIT,BUILD=(DATE2)),
IFTHEN=(WHEN=(5,2,ZD,LE,06),
BUILD=(C'CUR_YEAR,''',1,4,C'''')),
$
ICE005A 0 STATEMENT DEFINER ERROR
IFTHEN=(WHEN=NONE,
BUILD=(C'CUR_YEAR,''',1,4,ZD,ADD,+1,EDIT=(TTTT),C''''))
$
ICE005A 0 STATEMENT DEFINER ERROR
ICE010A 0 NO SORT OR MERGE CONTROL STATEMENT
Back to top
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
Sigh. The ICE005A message indicates you started INREC in column 1. Look at my example again. Every line starts with at least one blank. Shift all of your DFSORT control statements over at least one column:
Code:
1234...
OPTION COPY
INREC IFOUTLEN=80,
IFTHEN=(WHEN=INIT,BUILD=(DATE2)),
IFTHEN=(WHEN=(5,2,ZD,LE,06),
BUILD=(C'CUR_YEAR,''',1,4,C'''')),
IFTHEN=(WHEN=NONE,
BUILD=(C'CUR_YEAR,''',1,4,ZD,ADD,+1,EDIT=(TTTT),C''''))
It also appears you don't have the OPTION COPY statement that I have in my example.
Back to top
Suresh Shankarakrishnan New User Joined: 11 Jul 2008Posts: 42 Location: USA
Thanks Frank, that works.
Back to top
Please enable JavaScript!