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
 

 

Replace date field

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

New User


Joined: 16 Apr 2009
Posts: 69
Location: Canada

PostPosted: Tue May 28, 2013 12:25 am    Post subject: Replace date field
Reply with quote

I have a file with lrecl=80. There is date field at position 20 in yyyymmdd format. I am trying to encrypt the records with everything except the date as below (it contains only alphabets and numeric data).

Code:

SORT FIELDS=COPY                                                 
INREC IFTHEN=(WHEN=INIT,FINDREP=(STARTPOS=1,ENDPOS=19,           
       INOUT=(C'A',C'Z',C'B',C'Y',C'C',C'X',C'D',C'W',C'E',C'V', 
             C'F',C'U',C'G',C'T',C'H',C'S',C'I',C'R',C'J',C'Q',   
             C'K',C'P',C'L',C'O',C'M',C'N',C'N',C'M',C'O',C'L',   
             C'P',C'K',C'Q',C'J',C'R',C'I',C'S',C'H',C'T',C'G',   
             C'U',C'F',C'V',C'E',C'W',C'D',C'X',C'C',C'Y',C'B',   
             C'Z',C'A',                                           
             C'0',C'9',C'1',C'8',C'2',C'7',C'3',C'6',C'4',C'5',   
             C'5',C'4',C'6',C'3',C'7',C'2',C'8',C'1',C'9',C'0'))),
      IFTHEN=(WHEN=INIT,FINDREP=(STARTPOS=28,ENDPOS=80,           
       INOUT=(C'A',C'Z',C'B',C'Y',C'C',C'X',C'D',C'W',C'E',C'V', 
             C'F',C'U',C'G',C'T',C'H',C'S',C'I',C'R',C'J',C'Q',   
             C'K',C'P',C'L',C'O',C'M',C'N',C'N',C'M',C'O',C'L',   
             C'P',C'K',C'Q',C'J',C'R',C'I',C'S',C'H',C'T',C'G',   
             C'U',C'F',C'V',C'E',C'W',C'D',C'X',C'C',C'Y',C'B',   
             C'Z',C'A',                                           
             C'0',C'9',C'1',C'8',C'2',C'7',C'3',C'6',C'4',C'5',   
             C'5',C'4',C'6',C'3',C'7',C'2',C'8',C'1',C'9',C'0'))),


Then I am again sorting the dataset in the next step for changing the date by adding 385 to the number of days as mentioned below.

Code:

SORT FIELDS=COPY                                     
INREC OVERLAY=(20:20,8,Y4T,ADDDAYS,+395,TOGREG=Y4T)



Now I have 2 questions:

Can I merge these 2 sortcards into one because when I tried overlay isnt working if I put it alongwith the first sort card.
Can I use ADDDAYS, ADDMONS, ADDYEARS in the second sortcard together if I want to change +395 to years, months, days as 1 year, 1 month, 5 days in case of non-leap year?
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7225

PostPosted: Tue May 28, 2013 12:45 am    Post subject: Reply to: Replace date field
Reply with quote

Code:
  IFTHEN=(WHEN=INIT,OVERLAY=(20:20,8,Y4T,ADDDAYS,+395,TOGREG=Y4T))


I don't understand your second question. If ADDDAYS will work, why do you want to break it down like that?
Back to top
View user's profile Send private message
suraaj

New User


Joined: 16 Apr 2009
Posts: 69
Location: Canada

PostPosted: Tue May 28, 2013 12:57 am    Post subject: Reply to: Replace date field
Reply with quote

I was meaning that instead of 395 I just could mention it as 1 year, 1 month. The requirement is for 1 year and 1 month which I had calculated it as 395. It would be simpler if I just put it as 1 year and 1 month as below:

Code:

SORT FIELDS=COPY                                     
INREC OVERLAY=(20:20,8,Y4T,ADDYEARS,+1,TOGREG=Y4T,
                           20:20,8,Y4T,ADDMONS,+1,TOGREG=Y4T)


which is not working.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7225

PostPosted: Tue May 28, 2013 2:07 am    Post subject: Reply to: Replace date field
Reply with quote

You'll need to show what is "not working" about it.
Back to top
View user's profile Send private message
suraaj

New User


Joined: 16 Apr 2009
Posts: 69
Location: Canada

PostPosted: Tue May 28, 2013 2:16 am    Post subject: Reply to: Replace date field
Reply with quote

Meanwhile if someone could help me with my first question
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7225

PostPosted: Tue May 28, 2013 3:42 am    Post subject: Reply to: Replace date field
Reply with quote

I've answered your first question :-)

On INREC, if you use OVERLAY (or if you use BUILD), then you can't use IFTHEN.

BUT if you use IFTHEN, the IFTHEN can contain OVERLAY (or build).

So to put your two steps together, you take the line I've shown and add it to the IFTHENs you already have. It can be before, or after, as the results are not dependent on each other in this case.
Back to top
View user's profile Send private message
suraaj

New User


Joined: 16 Apr 2009
Posts: 69
Location: Canada

PostPosted: Tue May 28, 2013 7:21 pm    Post subject: Reply to: Replace date field
Reply with quote

Thanks Bill.

For my second question, I am getting SOC7 when I use the said sort card.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Tue May 28, 2013 7:28 pm    Post subject:
Reply with quote

Hello,

Then the data is incorrect or the position(s) are . . .

Show (in Hex) a record that causes the 0c7.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Tue May 28, 2013 11:49 pm    Post subject: Re: Replace date field
Reply with quote

suraaj wrote:

Now I have 2 questions:

Can I merge these 2 sortcards into one because when I tried overlay isnt working if I put it alongwith the first sort card.
Can I use ADDDAYS, ADDMONS, ADDYEARS in the second sortcard together if I want to change +395 to years, months, days as 1 year, 1 month, 5 days in case of non-leap year?


1. You are using the same FINDREP INOUT values. I suggest that you Move the date field to the end at pos 81 and then perform the FINDREP with endpos=80. You will be done with 1 FINDREP statement.

2. You can perform Addyears, addmons, adddays on the temp field at pos 81 and finally you can overlay it back again to position 20.

You are probably getting an error because conversion involving an input date with an invalid digit (A-F) will result in a data exception (0C7 ABEND) or an incorrect output value. so try to fix the invalid dates.
Back to top
View user's profile Send private message
suraaj

New User


Joined: 16 Apr 2009
Posts: 69
Location: Canada

PostPosted: Wed May 29, 2013 8:05 pm    Post subject: Reply to: Replace date field
Reply with quote

Thanks Skolusu....
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 Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts TOT & DATE parameter in ICEMAN hemanthj642 DFSORT/ICETOOL 4 Mon Nov 14, 2016 5:19 am
This topic is locked: you cannot edit posts or make replies. How to pass the previous month date i... Suganya87 DFSORT/ICETOOL 5 Mon Oct 31, 2016 4:13 pm
No new posts How to split the records using the am... vnktrrd DFSORT/ICETOOL 24 Fri Oct 28, 2016 7:33 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm


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