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

HOW TO OVERLAY A Packed decimal VALUE WITH ANOTHER PD VALUE


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

New User


Joined: 03 Dec 2020
Posts: 6
Location: India

PostPosted: Wed Dec 30, 2020 9:24 pm
Reply with quote

I have a requirement where the date in the input file which is stored in PD format has to be compared with a specific date and replaced with that date if the input date is lesser than the given date.

the layout of the input file starts like this and this is the first field of the input file.

05 X-KEY-1.
10 X-EFF-DATE PIC S9(09) COMP-3.

So, I have used the below code to achieve this in my JCL

SORT FIELDS=COPY
INREC IFTHEN=(WHEN=(1,5,PD,LE,20201111),
OVERLAY=(1:C'20201111'))

but the overridden output gets stored in the ZONED DECIMAL format instead of Packed decimal format. Could you please suggest me how to replace the date - '20201111' in PD format in the output file.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2023
Location: USA

PostPosted: Wed Dec 30, 2020 10:02 pm
Reply with quote

If this is a constant, the simple way is, to specify the packed decimal as its hex value.
Code:
 ...OVERLAY=(1:X’020201111C’)
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2023
Location: USA

PostPosted: Wed Dec 30, 2020 10:34 pm
Reply with quote

Probably, the packed constant P’20201111’ should work, too.
Just never tried it.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3053
Location: NYC,USA

PostPosted: Fri Jan 01, 2021 1:00 am
Reply with quote

I would suggest to use JPn if you have a constant date. If the Date changes in future then only JCL changes.
Code:
// SET DATE1='20201111'                           
//S1      EXEC PGM=SORT,PARM='JP1"&DATE1"'         
//*                                               
//SORTIN   DD  *                                   
TEST REC                                           
//SORTOUT   DD DSN=OUTPUT DSN                     
//SYSUDUMP DD  SYSOUT=*                           
//SYSOUT   DD  SYSOUT=*                           
//SYSPRINT DD  SYSOUT=*                           
//SYSIN     DD *                                   
   SORT FIELDS=COPY                               
   INREC  OVERLAY=(81:JP1,81,8,ZD,PD,LENGTH=5)     
/*
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3053
Location: NYC,USA

PostPosted: Fri Jan 01, 2021 1:05 am
Reply with quote

sergeyken wrote:
Probably, the packed constant P’20201111’ should work, too.
Just never tried it.
Not worked for me.
Back to top
View user's profile Send private message
mframe-guy

New User


Joined: 03 Dec 2020
Posts: 6
Location: India

PostPosted: Tue Jan 05, 2021 7:48 pm
Reply with quote

Rohit, your option has worked for me. Thank you Sergey and Rohit for your inputs
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 Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts PD not working for unsigned packed JO... DFSORT/ICETOOL 5
No new posts Def PD not working for unsigned packe... JCL & VSAM 3
No new posts Need Help with Packed Decimal Signs DFSORT/ICETOOL 4
No new posts Select a DB2 value in a specific deci... DB2 4
Search our Forums:

Back to Top