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

Convert date and merge to the first file


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

Active User


Joined: 01 Feb 2007
Posts: 123
Location: Hyderabad

PostPosted: Tue Feb 26, 2008 9:29 pm
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Tue Feb 26, 2008 10:11 pm
Reply with quote

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
View user's profile Send private message
bhaskar_kanteti

Active User


Joined: 01 Feb 2007
Posts: 123
Location: Hyderabad

PostPosted: Tue Feb 26, 2008 10:52 pm
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Tue Feb 26, 2008 11:08 pm
Reply with quote

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
View user's profile Send private message
bhaskar_kanteti

Active User


Joined: 01 Feb 2007
Posts: 123
Location: Hyderabad

PostPosted: Tue Feb 26, 2008 11:26 pm
Reply with quote

Hi,

Thank You so much.
You explained very clearly.
Thank You.
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 Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
Search our Forums:

Back to Top