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

Convert Date in PD to CH Db2 format


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

New User


Joined: 11 Jun 2009
Posts: 8
Location: Atlanta, GA

PostPosted: Thu Jun 18, 2009 4:46 pm
Reply with quote

RECFM=FB,LRECL=80 for both i/p and o/p

Need to convert the Date in format CYYMMDD with Pic Clause
s9(7) comp-3 to format 'MM/DD/CCYY' with Pic Clause x(10) thru SORT

For eq :
row1 of input file having Date : 1000511 in CYYMMDD

If C = 1 then in output CC = 20
else if C = 0 then CC = 19.

output row1 should be 05/11/2000 in MM/DD/CCYY

I/p file

Code:
 =COLS> ----+----1----
 ****** **************
 000100   é           
        10514444444444
        001C0000000000
 ---------------------
 000200  °           
        09214444444444
        800C0000000000
 ---------------------
 000300  é *         
        15154444444444
        011C0000000000
 ---------------------


output file
Code:
=COLS> ----+----1----+----2----+----
****** *****************************
000100 05/11/2000                     
000200 02/01/1989                     
000300 11/15/2005                     


Thanks,
Denny
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Thu Jun 18, 2009 8:42 pm
Reply with quote

archer_denny,

The following JCL will give you the desired results. I assumed that your input date is in pos 1 for 4 bytes and your input file is FB 80 bytes. The converted date will be again placed in pos 1 thru 10

Code:

//STEP0100 EXEC PGM=SORT                                           
//SYSOUT   DD SYSOUT=*                                             
//SORTIN   DD *                                                     
  é                                                                 
 °                                                                 
 é *                                                               
//SORTOUT  DD SYSOUT=*                                             
//SYSIN    DD *                                                     
  SORT FIELDS=COPY                                                 
  INREC IFOUTLEN=80,                                               
  IFTHEN=(WHEN=INIT,OVERLAY=(81:1,4,PD,EDIT=(TTTTTTTT))),           
  IFTHEN=(WHEN=(81,2,ZD,EQ,0),OVERLAY=(85,2,C'/',87,2,C'/19',83,2)),
  IFTHEN=(WHEN=(81,2,ZD,EQ,1),OVERLAY=(85,2,C'/',87,2,C'/20',83,2))
/*
Back to top
View user's profile Send private message
archer_denny

New User


Joined: 11 Jun 2009
Posts: 8
Location: Atlanta, GA

PostPosted: Thu Jun 18, 2009 11:08 pm
Reply with quote

Skolusu,
i'm out of my shop so i can't test your JCL now,
before that i have a clarification based on my observation on your jcl

you used the IFOUTLEN=80 with INREC st so that Output and its LRECL will be based on reformatted part after the 80th position

please let me know

Thanks,
Denny
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Thu Jun 18, 2009 11:29 pm
Reply with quote

archer_denny,

IFOUTLEN overrides the INREC LRECL (or reformatted record length if the INREC record is further modified) determined by DFSORT from your INREC IFTHEN clauses. DFSORT sets an appropriate LRECL for the output records based on the build and overlay items specified by the IFTHEN clauses.


Explanation of the control cards.

1. The first IFTHEN expands the 4 byte pd field to 8 byte readable format and puts it at pos 81
2. The next 2 IFTHEN statements validate the Century portion and accordingly pad the century portion along with separators in pos 1.

THE IFOUTLEN will truncate the output length to 80 , so that you don't have the temp expanded PD value at 81 in output.
Back to top
View user's profile Send private message
archer_denny

New User


Joined: 11 Jun 2009
Posts: 8
Location: Atlanta, GA

PostPosted: Thu Jun 18, 2009 11:40 pm
Reply with quote

Skolusu,

thanks for the detailed explanation of IFOUTLEN and the control cards

Thanks
Denny
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 Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts Populate last day of the Month in MMD... SYNCSORT 2
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Need to convert date format DFSORT/ICETOOL 20
No new posts Keep leading zero(s) after convert fl... SYNCSORT 7
Search our Forums:

Back to Top