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).
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?
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:
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
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.
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
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.