View previous topic :: View next topic
Author
Message
sijayapal New User Joined: 23 Dec 2008Posts: 69 Location: India
HI,
This is the problem i have in SORT. I have two conditions to be checked but i need to use a single sort card.
"IF 5,2,CH,EQ,C'95' and position 37 = J or K or L or M or N or O or P or Q or R or } THEN move } to position 62"
"IF 5,2,CH,EQ,C'97' then overwrite the position 37 and 62 with '}'."
Back to top
expat Global Moderator Joined: 14 Mar 2007Posts: 8797 Location: Welsh Wales
sijayapal wrote:
This is the problem i have in SORT. I have two conditions to be checked but i need to use a single sort card.
What do you mean by a single sort card. Do you mean one single card on one single line, or one set of statements that can span several lines.
Do you use DFSORT or SYNCSORT. Please post the output from
Code:
//SORTSTEP EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
ABC
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
Back to top
sijayapal New User Joined: 23 Dec 2008Posts: 69 Location: India
//SORTSTP1 EXEC PGM=SORT
//SORTIN DD DSN=************,DISP=SHR
//SORTOUT DD DSN=*************,
// DISP=(NEW,CATLG,DELETE),
// UNIT=DISK,
// SPACE=(TRK,(10,10))
//SYSOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INCLUDE FORMAT=SS,COND=(5,2,EQ,C'95',AND,
37,1,EQ,C'J,K,L,M,N,O,P,Q,R,}')
OUTREC OVERLAY=(62:C'}')
---------------------------------------------------
The above works fine.
I have to add the below condition also to the above one.
SORT FIELDS=COPY
OUTREC IFTHEN=(WHEN=(5,2,CH,EQ,C'97'),
OVERLAY=(37:C'}',62:C'}'))
Back to top
sijayapal New User Joined: 23 Dec 2008Posts: 69 Location: India
Its DFSORT and we dont have SYNC SORT
Back to top
CICS Guy Senior Member Joined: 18 Jul 2007Posts: 2146 Location: At my coffee table
Quote:
INCLUDE FORMAT=SS,COND=(5,2,EQ,C'95',AND,
37,1,EQ,C'J,K,L,M,N,O,P,Q,R,}')
.
.
.
The above works fine.
I can't figure how this is working, but why not treat the 95 & 97 the same way you treat the J, K, L, M, N, O, P, Q, R & }?
Frank or Kolusu:
Where is it documented that "37,1,EQ,C'J,K,L,M,N,O,P,Q,R,}" acts like a string or ORs? I searched and can't find any explanations or examples.
Where is it documented that FORMAT=SS is valid in an INCLUDE? I couldn't find it in 'Table 11. Permissible Field-to-Constant Comparisons for INCLUDE/OMIT'.
Back to top
sqlcode1 Active Member Joined: 08 Apr 2010Posts: 577 Location: USA
Refer to this post I read in my childhood...
www.ibmmainframes.com/viewtopic.php?t=5389
Something from Frank,
Quote:
Since the the separator character is generally needed, leaving it out for 1-byte fields is not actually covered in the doc, so I understand how you drew the conclusion you did. Of course, since I developed the code, I know how it actually works.
Thanks,
Back to top
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
Quote:
This is the problem i have in SORT. I have two conditions to be checked but i need to use a single sort card.
"IF 5,2,CH,EQ,C'95' and position 37 = J or K or L or M or N or O or P or Q or R or } THEN move } to position 62"
"IF 5,2,CH,EQ,C'97' then overwrite the position 37 and 62 with '}'."
sijayapal,
If I understand correctly what you want, then you would use these DFSORT control statements:
Code:
OPTION COPY
INREC IFTHEN=(WHEN=(5,2,CH,EQ,C'95',AND,37,1,SS,EQ,C'JKLMNOPQR}'),
OVERLAY=(62:C'}')),
IFTHEN=(WHEN=(5,2,CH,EQ,C'97'),OVERLAY=(37:C'}',62:C'}'))
Note that INCLUDE is used to include only certain records, whereas IFTHEN is used to modify only certain records.
Back to top
CICS Guy Senior Member Joined: 18 Jul 2007Posts: 2146 Location: At my coffee table
Back to top
Please enable JavaScript!