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

2 byte YEAR from Y'DATE2' field


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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: 88
Location: India

PostPosted: Tue Feb 07, 2017 2:13 pm
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Data set Rec-Cnt and Byte-Cnt Testing & Performance 2
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts 10 byte RBA conversion DB2 2
No new posts 10 byte RBA conversion -non applicati... JCL & VSAM 1
No new posts DATE2 function SYNCSORT 15
Search our Forums:

Back to Top