jzhardy
Active User
Joined: 31 Oct 2006 Posts: 131 Location: brisbane
|
|
|
|
two questions (looked thru the tutorial guides, but could not find any helpful examples) -
1. Is it possible to add a value to a symbolic constant where it defines an offset
eg, instead of
OVERLAY=(49:f1_c_w) ...
I would prefer (for readability) something that achieves :
OVERLAY=((f2_c+5):f1_c_w) ...
2. Suppose I have a file with a column for year (say at 10,4) defined as type char (YYYY). I want to add a constant to the year value where the record matches some criteria, but leave the result as CHAR.
how can this be done within an OVERLAY ?
eg -
....
IFTHEN=(WHEN=(44,1,CH,EQ,C'Z'),
OVERLAY= ??? |
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
1. I'm not sure I understand what you're trying to do, but here's an example of using f2_c_p5 as a symbolic constant representing the position of f2_c + 5. Note that + is not allowed in symbols, so I used p5 (for plus 5) instead.
Code: |
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SYMNAMES DD *
f1_c_w,5,8
f2_c,44
POSITION,f2_c
SKIP,5
f2_c_p5,*
/*
//SYMNOUT DD SYSOUT=*
//SORTIN DD DSN=... input file
//SORTOUT DD DSN=... output file
//SYSIN DD *
OPTION COPY
INREC OVERLAY=(f2_c_p5:f1_c_w)
/*
|
The INREC statement will be translated to:
Code: |
INREC OVERLAY=(49:5,8)
|
2. Just treat the 4-byte YYYY value as ZD.
Code: |
IFTHEN=(WHEN=(44,1,CH,EQ,C'Z'),
OVERLAY=(10:10,4,ZD,ADD,+n,TO=ZD,LENGTH=4))
|
where +n is the constant (you must use +n and not n). |
|