|
View previous topic :: View next topic
|
| Author |
Message |
suraaj
New User
.jpg)
Joined: 16 Apr 2009 Posts: 69 Location: Canada
|
|
|
|
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 |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
| 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 |
|
 |
suraaj
New User
.jpg)
Joined: 16 Apr 2009 Posts: 69 Location: Canada
|
|
|
|
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 |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
| You'll need to show what is "not working" about it. |
|
| Back to top |
|
 |
suraaj
New User
.jpg)
Joined: 16 Apr 2009 Posts: 69 Location: Canada
|
|
|
|
| Meanwhile if someone could help me with my first question |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
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. |
|
| Back to top |
|
 |
suraaj
New User
.jpg)
Joined: 16 Apr 2009 Posts: 69 Location: Canada
|
|
|
|
Thanks Bill.
For my second question, I am getting SOC7 when I use the said sort card. |
|
| Back to top |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
Then the data is incorrect or the position(s) are . . .
Show (in Hex) a record that causes the 0c7. |
|
| Back to top |
|
 |
Skolusu
Senior Member
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. |
|
| Back to top |
|
 |
suraaj
New User
.jpg)
Joined: 16 Apr 2009 Posts: 69 Location: Canada
|
|
|
|
| Thanks Skolusu.... |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|