Author: sergeyken
Posted: Sun Aug 28, 2016 7:37 pm (GMT 5.5)
Note 1
SORT statement semantics is wrong for SS (SubString) format/function. The syntax is correct, but it doesn't work as expected by author.
The correct statement would be either (using SS,EQ):
or (using CH,EQ):
Note 2
String manipulation in COBOL is possible, but extremly inconvenient. The easier way is using REXX or some other tools.
REXX option:
_________________
Tyrannosaurus-REXX
Posted: Sun Aug 28, 2016 7:37 pm (GMT 5.5)
Note 1
SORT statement semantics is wrong for SS (SubString) format/function. The syntax is correct, but it doesn't work as expected by author.
The correct statement would be either (using SS,EQ):
Code: |
INCLUDE COND=(C'XXX1,YYY2,ZZZ1',EQ,1,4, OR,C'XXX2,YYY2,ZZZ2',EQ,1,4, OR,C'XXX3,YYY3',EQ,1,4),FORMAT=SS |
or (using CH,EQ):
Code: |
INCLUDE COND=(1,4,EQ,L(C'XXX1',C'YYY2',C'ZZZ1'), OR,1,4,EQ,L(C'XXX2',C'YYY2',C'ZZZ2'), OR,1,4,EQ,L(C'XXX3',C'YYY3')),FORMAT=CH |
Note 2
String manipulation in COBOL is possible, but extremly inconvenient. The easier way is using REXX or some other tools.
REXX option:
Code: |
. . . "execio * diskr SELECTDD (stem ListSel. finis" /* read into stem variable */ Step = 3 Do i = 1 by Step to ListSel.0 StrWords = '' Do j = i to (i + Step - 1) StrWords = StrWords || ListSel.j If j >= ListSel.0 Then Leave j StrWords = StrWords || ',' End j If i = 1 Then StrStmt = " INCLUDE COND=(C'" Else StrStmt = " OR,C'" StrStmt = StrStmt || StrWords If (i + Step - 1) < ListSel.0 Then StrStmt = StrStmt || "'," Else StrStmt = StrStmt || "'),FORMAT=SS" Queue StrStmt End i "execio * diskw OUTDD (finis" /* write all lines from program stack */ |
_________________
Tyrannosaurus-REXX