|
View previous topic :: View next topic
|
| Author |
Message |
madmartinsonxx
New User

Joined: 10 Dec 2010 Posts: 96 Location: Massachusetts
|
|
|
|
hi,
followed a reply by sokulsu trying to get the weekday on a report. i can get saturday but i think maybe i am missing an option.
input:
| Code: |
03/20/2012 20120320
|
statements:
| Code: |
OPTION COPY
INREC IFTHEN=(WHEN=INIT,BUILD=(342,04,PD0,X,
024,04,PD,EDIT=(IIIIIIIIIIT))),
IFTHEN=(WHEN=INIT,BUILD=(3,2,C'/',5,2,C'/20',1,2,X,
C'20',1,2,3,2,5,2,X,
12,8,Y4T,WEEKDAY=CHAR9,
09,12))
|
output:
| Code: |
20120320 SATURDAY
20120320 SATURDAY
20120320 *********
20120320 *********
20120320 *********
20120320 *********
20120320 *********
20120320 *********
20120320 *********
|
looked pretty straight forward to me but...
thanks again. |
|
| Back to top |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
madmartinsonxx,
You need to realize how BUILD works. The Second BUILD is picking the edited value 024,04,PD,EDIT=(IIIIIIIIIIT) as input for weekday function and hence the asterisks as the dates may not be valid. You only got lucky where the edited number ended up as a valid date.
You have a very confusing way of getting things done. You are picking 2 fields and they are using only 1 field in the output.
I am guessing that your input fields are as below
| Code: |
pos 24 - 4 bytes of PD field
pos 342 - 4 bytes of Date field
|
Now just tell me what do you need in the output and we will show you a way to do it. |
|
| Back to top |
|
 |
madmartinsonxx
New User

Joined: 10 Dec 2010 Posts: 96 Location: Massachusetts
|
|
|
|
yes, those are my fields. output should look like:
| Code: |
03/19/2012 20120319 7185482
03/19/2012 20120319 7185482
03/19/2012 20120319 7187205
03/19/2012 20120319 7187205
03/19/2012 20120319 7187205
03/19/2012 20120319 7185830
03/19/2012 20120319 7185296
03/20/2012 20120320 7189020
03/20/2012 20120320 7189020
03/20/2012 20120320 7189022
03/20/2012 20120320 7189025
03/20/2012 20120320 7189037
03/20/2012 20120320 7189037
|
..with weekday mneumonic just after the 8 byte date, call it the 3rd field, and before the last numeric field. |
|
| Back to top |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
madmartinsonxx,
Use the following control cards which will give you the desired results. I used Y2PAST=2000 as you said all your dates are greater than 2000. If you have 19xx dates then they can also be handled but differently.
| Code: |
//SYSIN DD *
OPTION COPY,Y2PAST=2000
INREC IFOUTLEN=40,IFTHEN=(WHEN=INIT,
BUILD=(31:24,4,PD,M10,LENGTH=10,342,4,PD0)),
IFTHEN=(WHEN=INIT,OVERLAY=(43,2,C'/',45,2,C'/20',41,2,X,
41,6,Y2T,TOGREG=Y4T,X,41,6,Y2T,WEEKDAY=CHAR9))
//* |
The output from the above control cards is
| Code: |
mm/dd/ccyy ccyymmdd 9-charday IIIIIIIIIT
|
|
|
| Back to top |
|
 |
madmartinsonxx
New User

Joined: 10 Dec 2010 Posts: 96 Location: Massachusetts
|
|
|
|
| thank you. guess i can scratch this one from my bucket list ! cheers. |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|