Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
2 byte YEAR from Y'DATE2' field

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

Active User


Joined: 22 May 2009
Posts: 160
Location: Bangalore

PostPosted: Tue Feb 07, 2017 12:05 pm    Post subject: 2 byte YEAR from Y'DATE2' field
Reply with quote

Hi,
I have been using the DATE2 field for formatting in the sort card for Overlay.

The condition is to overlay the date field in the file with previous month and year of YYMM format but the overlay option is unable to hold the Y'DATE2'-1

Code:
INREC IFTHEN=(WHEN=(1,4,CH,EQ,X'00',OR,1,4,CH,EQ,X'40'),
OVERLAY=(1:Y'DATE2'-1))


The sort card throws a syntax error for using Y'DATE2'-1.
Back to top
View user's profile Send private message

Abid Hasan

New User


Joined: 25 Mar 2013
Posts: 86
Location: India

PostPosted: Tue Feb 07, 2017 2:13 pm    Post subject:
Reply with quote

Hello,

The format: Y'DATE2'-1, is allowed in INCLUDE/OMIT conditions but not for date insertions. Also, even if it did yield the date, it would be in ccyymm format and not yymm as you're expecting.

Instead, a solution can be (assuming an LRECL 30, as you haven't specified it):

Code:

000011 //SORTIN   DD *                                                         
000012      DUMMY RECORD                                                       
       00004CEDDE4DCCDDC
       00000444480953694
----------------------------------
000013 /*                                                                     
000014 //SORTOUT  DD SYSOUT=*                                                 
000015 //SYSIN    DD *                                                         
000016 *                                                                       
000017 * ASSUMPTION: LRECL OF 30 TO BE SET FOR THE FINAL OUTPUT.               
000018 *                                                                       
000019  INREC IFOUTLEN=30,                                                     
000020 *                                                                       
000021 * PERFORM THE CONDITIONAL CHECK FOR LOW-VALUES/SPACES DURING INREC     
000022 * PROCESSING.                                                           
000023 *                                                                       
000024        IFTHEN=(WHEN=(1,4,CH,EQ,X'00',OR,1,4,CH,EQ,X'40'),               
000025 *                                                                       
000026 * TEMPORARILY EXTEND THE RECORD BY 4 6 BYTES OF 'DATE2-1', THEN PAD THIS
000027 * SAME VALUE TO THE FIRST 4 BYTES IN 4Y2T FORMAT.                       
000028 *                                                                       
000029                OVERLAY=(31:DATE2-1,1:33,4))         
000030 *                                                   
000031 * NOW THAT THE RECORD IS READY, WRITE IT TO OUTPUT.
000032 *                                                   
000033  SORT FIELDS=COPY                                   
000034 /*                                                                                                 


The output:

Code:

000001 1701 DUMMY RECORD
       FFFF4CEDDE4DCCDDC
       17010444480953694
------------------------
Back to top
View user's profile Send private message
tecnokrat
Warnings : 1

Active User


Joined: 22 May 2009
Posts: 160
Location: Bangalore

PostPosted: Tue Feb 07, 2017 4:00 pm    Post subject: Reply to: 2 byte YEAR from Y'DATE2' field
Reply with quote

Abid, its true the DATE2-1 yielded me the ccyymm and not yymm format.

I tried the overlay option to reformat the date2-1 values and the desired result is achieved
Code:
 OVERLAY=(31:DATE2-1,1:33,4))       


icon_smile.gif

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
This topic is locked: you cannot edit posts or make replies. Incrementing current time field by 30... arunsoods DFSORT/ICETOOL 11 Thu Oct 26, 2017 3:22 pm
No new posts Copy 4 byte of data from the last rec... arunsoods DFSORT/ICETOOL 9 Fri Oct 06, 2017 12:15 pm
No new posts sort records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm
No new posts Partial color change of a field in CI... waseem0424 CICS 5 Fri Sep 29, 2017 7:56 pm
No new posts Fetch Previous month & year in MM... girishb2 DFSORT/ICETOOL 3 Thu Sep 21, 2017 9:54 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us