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 YYYYMMDD to YYYMMDD in R.O.C format

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

New User


Joined: 27 Aug 2006
Posts: 41
Location: Taiwan

PostPosted: Wed Nov 04, 2015 2:09 pm    Post subject: Convert YYYYMMDD to YYYMMDD in R.O.C format
Reply with quote

Hello,

I need to convert western current date "20151104" to "1041104",which is the date format of my country - Republic of Chinese (Taiwan).

The syntax I used :
Code:
OUTFIL BUILD=(DATE1,SUB,+19110000,TO=CH,LENGTH=6)


and, the error message :
Code:

********************************* TOP OF DATA **********************************
ICE200I 0 IDENTIFIER FROM CALLING PROGRAM IS 0001                               
ICE805I 0 JOBNAME: YBAI1099 , STEPNAME: S0                                     
ICE802I 0 BLOCKSET     TECHNIQUE IN CONTROL                                     
ICE143I 0 BLOCKSET     COPY  TECHNIQUE SELECTED                                 
ICE250I 0 VISIT http://www.ibm.com/storage/dfsort FOR DFSORT PAPERS, EXAMPLES AN
ICE000I 0 - CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R12 - 16:22 ON WED NO
          * OUTFIL OVERLAY=(139:(DATE1P,SUB,+20110000,M11,LENGTH=6))           
            OUTFIL BUILD=(DATE1,SUB,+20110000,TO=CH,LENGTH=6)                   
                                $                                               
ICE007A E SYNTAX ERROR                                                         
          * OUTFIL BUILD=(DATE1P,TO=CH,LENGTH=8)                               
ICE146I 0 END OF STATEMENTS FROM CTR1CNTL - PARAMETER LIST STATEMENTS FOLLOW   


Is it possible to treate DATE1P as a number in arithmetic expression?

Jacob
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Wed Nov 04, 2015 2:30 pm    Post subject: Reply to: Convert YYYYMMDD to YYYMMDD in R.O.C format
Reply with quote

Application Programming Guide wrote:
DATE1, &DATE1, DATE1(c), DATE1(c), DATE2, &DATE2, DATE2(c), &DATE2(c), DATE3, &DATE3, DATE3(c) or &DATE3(c) can be used to generate a character constant for the current date of the run. DATE1P, &DATE1P, DATE2P, &DATE2P, DATE3P or &DATE3P can be used to generate a packed decimal constant for the current date of the run.


Also, you say TO=CH, you want TO=ZD, and your LENGTH=6 will cause truncation.
Back to top
View user's profile Send private message
jacobdng

New User


Joined: 27 Aug 2006
Posts: 41
Location: Taiwan

PostPosted: Wed Nov 04, 2015 2:37 pm    Post subject:
Reply with quote

Bill,
Since "Packed Decimal" format cannot be displayed, I have to change it to "Character" format.

As for the issue of truncation, LENGTH=6 can be changed to LENGTH=7, but the syntax error is still there.

What is wrong with my sentence?

Jacob
Back to top
View user's profile Send private message
jacobdng

New User


Joined: 27 Aug 2006
Posts: 41
Location: Taiwan

PostPosted: Wed Nov 04, 2015 3:00 pm    Post subject:
Reply with quote

My office hour is over.
Will be back tomorrow.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Wed Nov 04, 2015 4:59 pm    Post subject: Reply to: Convert YYYYMMDD to YYYMMDD in R.O.C format
Reply with quote

I didn't do such a good job of formatting the quote from the manual, so I've fixed that.

You can't do arithmetic with a "character" field.

You can't do arithmetic, like that, with a date-constant.

With a date-constant, modification by a number of days or months to give a future or past date is possible, it is built in. However, there is a limit of 9999 days, or months, that you can modify by. Your 1911 years would be too many months.


Quote:
Is it possible to treat DATE1P as a number in arithmetic expression?


No. So you have to do it a different way.

It looks as though you are just testing to use the code later. So your final code may be different.

So, for illustration:

Code:
  OPTION COPY
  OUTFIL IFOUTLEN=7,
        IFTHEN=(WHEN=INIT,
                 BUILD=(DATE1)),
        IFTHEN=(WHEN=INIT,
                 OVERLAY=(1,4,ZD,
                           SUB,
                            +1911,
                           TO=ZD,
                           LENGTH=4)),
        IFTHEN=(WHEN=INIT,
                 OVERLAY=(2,7))


The output is:

Code:
1041104


It is the second IFTHEN which is significant and which makes the amendment to the year portion of a date.

The first IFTHEN puts the 8-character date into the current record.

The third IFTHEN shifts the data left so that you get your seven-character date in the first seven positions.

The IFOUTLEN=7 says "once IFTHEN processing is complete, make the record-length seven".

If you can provide an example of how you want to actually use this, some more directly relevant code can be provided.

I assume that you have realised you must only do this conversion of the date as the last thing. If you were to convert early, or take already converted data and use DFSORT's date functions, you will not (always) get the correct result, because your starting-point year is not going to allow the correct calculation of leap-years for the date functions.
Back to top
View user's profile Send private message
jacobdng

New User


Joined: 27 Aug 2006
Posts: 41
Location: Taiwan

PostPosted: Thu Nov 05, 2015 6:38 am    Post subject:
Reply with quote

Bill,
Thanks for your answer.
It is enough to know that the date-constant cannot be treated as what I thought before.

Your solution is good for my situation.

Jacob
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 convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts Convert +9999999999999.99 to S9(12)V9(3) vnktrrd DFSORT/ICETOOL 8 Thu Nov 17, 2016 8:15 pm
This topic is locked: you cannot edit posts or make replies. Db2 SQL query to convert rows into co... subratarec DB2 5 Thu Nov 17, 2016 4:51 pm
No new posts convert PD to ZD ram_vizag DFSORT/ICETOOL 5 Sat Nov 05, 2016 3:06 am
No new posts Match or compare two files in VB Format anatol DFSORT/ICETOOL 14 Thu Nov 03, 2016 7:41 pm


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