View previous topic :: View next topic
|
Author |
Message |
madishpa
New User
Joined: 18 May 2007 Posts: 28 Location: Hyderabad
|
|
|
|
I want to use arthematic operators in INCLUDE COND, to check the difference between two fields and wirte the value to output file if it is greater than 45. Is this possible using SORT ( in INCLUDE COND). If yes, Can any one please suggest.
Thanks in advance. |
|
Back to top |
|
|
PeterHolland
Global Moderator
Joined: 27 Oct 2009 Posts: 2481 Location: Netherlands, Amstelveen
|
|
|
|
After you did a search/read in the manual (you did, didnt you?) what conclusion you got? |
|
Back to top |
|
|
gylbharat
Active Member
Joined: 31 Jul 2009 Posts: 565 Location: Bangalore
|
|
|
|
You can use Inrec to specify the difference at the last of the column. Then use INCLUDE CODE to check if the difference is greater than 45.
The below code might give you some idea. Not tested it.
Code: |
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=INIT,OVERLAY=(7:04,2,ZD,SUB,1,2,ZD,LENGTH=3))
INCLUDE COND=(07,3,ZD,GT,+20)
|
[/code] |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
gylbharat,
That will NOT work because the INCLUDE statement is processed before the INREC statement. OUTFIL INCLUDE would work since the OUTFIL statement is processed after the INREC statement.
madishpa,
You can use a DFSORT job something like this:
Code: |
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
12345 12345
20000 10000
20045 20000
20046 20000
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC OVERLAY=(81:1,5,ZD,SUB,11,5,ZD,TO=ZD,LENGTH=8)
OUTFIL INCLUDE=(81,8,ZD,GT,+45),BUILD=(1,80)
/*
|
If you need more specific help, give more details of the fields, RECFM, LRECL, etc. |
|
Back to top |
|
|
gylbharat
Active Member
Joined: 31 Jul 2009 Posts: 565 Location: Bangalore
|
|
|
|
Thanks Frank. This is really helpful... |
|
Back to top |
|
|
|