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 in PD to CH Db2 format

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Convert Date in PD to CH Db2 format
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    Post subject: Reply to: Convert Date in PD to CH Db2 format
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    Post subject: Reply to: Convert Date in PD to CH Db2 format
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    Post subject:
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    Post subject: Reply to: Convert Date in PD to CH Db2 format
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    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 How to add header with Date(YYMMDD) i... Rajan Moorthy DFSORT/ICETOOL 2 Thu Jul 06, 2017 11:44 pm
No new posts Convert CLIST to REXX cvnlynn CLIST & REXX 12 Tue Jun 27, 2017 2:06 am
No new posts Need to write record of PS File in ex... Chandan1993 JCL & VSAM 1 Wed Jun 07, 2017 1:35 am
No new posts Validate date and numeric fields and ... Rick Silvers DFSORT/ICETOOL 6 Thu May 11, 2017 6:51 pm
No new posts LISTIDR compiled date/time jerryte IBM Tools 3 Thu Apr 20, 2017 7:37 pm


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