Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Convert date and merge to the first file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
bhaskar_kanteti

Active User


Joined: 01 Feb 2007
Posts: 120
Location: USA

PostPosted: Tue Feb 26, 2008 9:29 pm    Post subject: Convert date and merge to the first file
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 Moderator


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

PostPosted: Tue Feb 26, 2008 10:11 pm    Post subject:
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: 120
Location: USA

PostPosted: Tue Feb 26, 2008 10:52 pm    Post subject: Reply to: Convert date and merge to the first file
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 Moderator


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

PostPosted: Tue Feb 26, 2008 11:08 pm    Post subject:
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: 120
Location: USA

PostPosted: Tue Feb 26, 2008 11:26 pm    Post subject: Reply to: Convert date and merge to the first file
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    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 Changing of LRECL of a file abdulrafi DFSORT/ICETOOL 2 Fri Mar 24, 2017 3:25 pm
No new posts splitting a file abdulrafi DFSORT/ICETOOL 4 Fri Mar 24, 2017 11:51 am
No new posts Receive a file using PCOMM macro Harald.v.K IBM Tools 0 Thu Mar 23, 2017 6:50 pm
No new posts Export flat file data into excel sheet murali.andaluri DFSORT/ICETOOL 2 Mon Mar 20, 2017 5:39 pm
No new posts Formatting VB File Learncoholic DFSORT/ICETOOL 3 Mon Mar 20, 2017 12:29 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us