View previous topic :: View next topic
Author
Message
zh_lad Active User Joined: 06 Jun 2009Posts: 115 Location: UK
Hi,
I have a static file which I want to use daily. However, I want to change the date (julian format) to current date before I use it.
apart from other records, I have three records where I have date in julina formant and I want to change the date using sort.
----+----1----+----2----+----3----+----4
90Ðå48408514100 000014100N0300TEST00000
91 004840851410000000000000000000000000
92 004840851410000000000000000000000000
Date is on record type (column 1, length2, CHAR) 90, 91 and 92
File is FB and LRECL 170
above julian date is 14100 (YYDDD). It occurs twice on record type 90 (column 11 and 22) and once on record type 91 and 92, column 13.
I want to write a sort card to change this date to current system date.
Thanks,
zh_lad
Back to top
zh_lad Active User Joined: 06 Jun 2009Posts: 115 Location: UK
It's a temporary fix to handle 'file not arriving' scenario. Will be taken off once sending system is ready.
Once I know the solution, I will try to get this date from a date file.
Hope I have answered your questions.
Back to top
Bill Woodger Moderator Emeritus Joined: 09 Mar 2011Posts: 7309 Location: Inside the Matrix
You missed the irony.
I think the generate-the-symbol approach is easiest, even for a once-off.
Have one step with SYSIN DD * and "SOMETHING, NOT RELEVANT" as the data.
OPTION COPY,STOPAFT=1
INREC to get julian date, and format it as a symbol on a symbol file.
Remember to create 80-byte records, so have 80:X at the end of your BUILD.
In your actual step, include DD for SYMNAMES which dataset from SORTOUT from above step, SYMNOUT DD so that you can see what is being used.
Then, on INREC, just identify each record, and OVERLAY the symbol's value in the appropriate place(s) for each record.
If it is a once-off, why not hard-code it, but that is another question....
Back to top
zh_lad Active User Joined: 06 Jun 2009Posts: 115 Location: UK
I will come back to above solution. Mean while, I have used below sort card to extract current system date:
Input:
Code:
----+----1----+----2----+----3----+----4----+----5----+
*******************************************************
90Ðå48408514100 000014100N0300TEST00000000001000000000
91 004840851410000000000000000000000000000000000100000
92 004840851410000000000000000000000000000000000100000
SORT Card
Code:
OPTION COPY
OUTREC IFTHEN=(WHEN=(1,2,CH,EQ,C'90'),
OVERLAY=(12:DATE1,22:DATE1)),
IFTHEN=(WHEN=(1,2,CH,EQ,C'91'),
OVERLAY=(13:DATE1)),
IFTHEN=(WHEN=(1,2,CH,EQ,C'92'),
OVERLAY=(13:DATE1))
Output:
Code:
----+----1----+----2----+----3----+----4----+----5----+
*******************************************************
90Ðå484085120140512002014051200TEST00000000001000000000
91 004840852014051200000000000000000000000000000100000
92 004840852014051200000000000000000000000000000100000
DATE1 is overlaying date in CCYYMMDD format. Is there a current date operand to overlay date in julian format?
I found something on Date Conversion line..
Code:
OUTREC IFTHEN=(WHEN=(1,2,CH,EQ,C'90'),
OVERLAY=(12:DATE1,Y4T,TOJUL=Y4U))
But it does not work.
Many thanks.
Back to top
Bill Woodger Moderator Emeritus Joined: 09 Mar 2011Posts: 7309 Location: Inside the Matrix
Y4 means a four-digit year. Y2 means a two-digit year. Is that the only problem? "It does not work" is never very helpful if we don't know exactly how it didn't work for you. I'm sure that Y4U does work.
Back to top
zh_lad Active User Joined: 06 Jun 2009Posts: 115 Location: UK
It was giving below error:
Code:
ICE000I 1 - CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R12
OPTION COPY
OUTREC IFTHEN=(WHEN=(1,2,CH,EQ,C'90'),
OVERLAY=(12:DATE1,Y4T,TOJUL=Y4U))
£
ICE006A 0 OPERAND DEFINER ERROR
I understand DATE1 is C'yyyymmdd' and Y4T is C'ccyymmdd', still it is giving Operand define error. Can you please advice? Thanks
Back to top
Bill Woodger Moderator Emeritus Joined: 09 Mar 2011Posts: 7309 Location: Inside the Matrix
The Fine Manual wrote:
p,m,Y2x or p,m,Y4x
Specifies that an input date field is to be edited.
Now, is DATE1,Y4T of the format p,m,Y4T?
Code:
OUTREC IFTHEN=(WHEN=(1,2,CH,EQ,C'90'),
OVERLAY=(12:DATE1,
12:12,8,TOJUL=Y4U))
Experiment along those lines.
You will lose a byte of your data, so extend your record temporarily to include DATE1 at the new location, then put it, converted, into column 12.
Back to top
Bill Woodger Moderator Emeritus Joined: 09 Mar 2011Posts: 7309 Location: Inside the Matrix
Perhaps you should look here and cut out the middleman, just using system symbols. Give it a whirl.
Back to top
zh_lad Active User Joined: 06 Jun 2009Posts: 115 Location: UK
Thanks Bill. While you replied, worked on solution you suggested initially, using SYMNAMES. So far I had never used SYMNAMES, though I have seen people using it.
SYMNAMES is the easiest solution. Here is my JCL
Step one to extract julian date from calender file (pos 15, L 5)
Code:
//STEP001 EXEC PGM=SORT
//SORTIN DD DISP=SHR,DSN=my calendar file
//SORTOUT DD DSN=my symbol file,
// DISP=(,CATLG),SPACE=(TRK,(1,1))
//SYSIN DD *
OPTION COPY
INREC BUILD=(C'MYDATE,''',15,5,C'''',80:X)
//SYSOUT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
and later using symbol MYDATE
Code:
//STEP002 EXEC PGM=SORT
//SYMNAMES DD DISP=SHR,DSN=my symbol file
//SORTIN DD DISP=SHR,DSN=my input file
//*
//SORTOUT DD DSN=output with edited julian date,
// DISP=(,CATLG),SPACE=(TRK,(5,2))
//SYSIN DD *
OPTION COPY
OUTREC IFTHEN=(WHEN=(1,2,CH,EQ,C'90'),
OVERLAY=(11:MYDATE,22:MYDATE)),
IFTHEN=(WHEN=(1,2,CH,EQ,C'91'),
OVERLAY=(13:MYDATE)),
IFTHEN=(WHEN=(1,2,CH,EQ,C'92'),
OVERLAY=(13:MYDATE))
//SYSOUT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
It worked well!
Thanks.
Back to top
Please enable JavaScript!