View previous topic :: View next topic
Author
Message
bhaskar_kanteti Active User Joined: 01 Feb 2007Posts: 123 Location: Hyderabad
Hi,
I had two inout files.
Input File 1: FB, LRECL = 15
Field1 Field2 Field3
11111AAAAA24334
22222BBBBB34433
33333CCCCC43254
Input File 2: FB, LRECL = 5
This file has only 1 field of type S9(9) Comp-3 which holds date.
The date will be as 20080226.
This should be converted to X(10) as 2008-02-26 and should be appeneded at the end of the Input file 1.
My Output File: FB, LRECL = 25
Field1 Field2 Field3 Field4
11111AAAAA24334 2008-02-26
22222BBBBB34433 2008-02-26
33333CCCCC432542008-02-26
How can i convert DATE and append to the file.
Is it possible to convert date from S9(9) Comp-3 to X(10).
Help me in this regard.
Back to top
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
Here's a DFSORT job that will do what you asked for:
Code:
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file2 (FB/5 - with date)
//SORTOUT DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//SYSIN DD *
OPTION COPY
* Create a DFSORT Symbol as follows:
* TDATE,'yyyy-mm-dd'
INREC BUILD=(C'TDATE,''',1,5,PD,EDIT=(TTTT-TT-TT),C'''',80:X)
/*
//S2 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
//SORTIN DD DSN=... input file1 (FB/15)
//SORTOUT DD DSN=... output file (FB/25)
//SYSIN DD *
OPTION COPY
* Append TDATE to the end of each record.
INREC OVERLAY=(16:TDATE)
/*
Back to top
bhaskar_kanteti Active User Joined: 01 Feb 2007Posts: 123 Location: Hyderabad
Hi Frank,
Thank You so much.
It worked.
Can you clarify me regarding this how it was written.
Code:
INREC BUILD=(C'TDATE,''',1,5,PD,EDIT=(TTTT-TT-TT),C'''',80:X)
Back to top
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
As I said in the comment, it creates a DFSORT symbol like this:
TDATE,'yyyy-mm-dd'
C'TDATE,''' creates:
TDATE,'
1,5,PD,EDIT=(TTTT-TT-TT) converts the PD date (X'0yyyymmddC') to:
yyyy-mm-dd
C'''' adds the ending apostrophe.
80:X pads with blanks up to position 80 and sets the LRECL to 80 bytes which is required for the SYMNAMES data set.
Back to top
bhaskar_kanteti Active User Joined: 01 Feb 2007Posts: 123 Location: Hyderabad
Hi,
Thank You so much.
You explained very clearly.
Thank You.
Back to top
Please enable JavaScript!