View previous topic :: View next topic
|
Author |
Message |
Sureznicky
New User
Joined: 29 Apr 2014 Posts: 2 Location: India
|
|
|
|
Hi,
I have a requirement in which i have to read a control card and create output file based on the range(highlighted in yellow) present in control card.
Code: |
Control card--012345001 029820000 9
100018369 102347359 9 |
output file should be like below:
Code: |
SORT FIELDS=(6,6,BI,A,632,8,BI,A,20,17,BI,A,37,7,BI,D)
OUTFIL FILES=01,
INCLUDE=(0005,001,CH,EQ,C'0',
OR,
0005,001,CH,EQ,C'9',
OR,
(0100,008,BI,GE,0012345001,
AND,
0100,008,BI,LE,0029820000),
OR,
(0100,008,BI,GE,0100018369,
AND,
0100,008,BI,LE,0102347359))
|
Based on control card range 100,8 position in o/p file has to written. remaining are all should be built as it is.
Please guide me to create this using sort/eazytrieve.
Code'd |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
the yellow color makes the post unreadable |
|
Back to top |
|
|
Sureznicky
New User
Joined: 29 Apr 2014 Posts: 2 Location: India
|
|
|
|
Sorry for making it unreadable.
I have a requirement in which i have to read a control card and create output file based on the range present in control card.
Code: |
Control card--012345001 029820000 9
100018369 102347359 9 |
output file should be like below:
Code: |
SORT FIELDS=(6,6,BI,A,632,8,BI,A,20,17,BI,A,37,7,BI,D)
OUTFIL FILES=01,
INCLUDE=(0005,001,CH,EQ,C'0',
OR,
0005,001,CH,EQ,C'9',
OR,
(0100,008,BI,GE,0012345001,
AND,
0100,008,BI,LE,0029820000),
OR,
(0100,008,BI,GE,0100018369,
AND,
0100,008,BI,LE,0102347359)) |
Based on control card range 100,8 position in o/p file has to written. remaining are all should be built as it is.
Please guide me to create this using sort/eazytrieve.
Code'd |
|
Back to top |
|
|
Devil_13
New User
Joined: 17 Mar 2015 Posts: 2 Location: India
|
|
|
|
Hi Suresh
I think you can do it using a combination of OUTFIL HEADER1,,HEADER3 and TRAILER1.
you can refer to this sample code:
Code: |
SORT FIELDS=COPY
OUTFIL FNAMES=SORTOUT,REMOVECC,NODETAIL,
SECTIONS=(1,8
HEADER3=(C'(0100,008,BI,GE,',1,8,,C',',/,
C'AND',',/,
C'0100,008,BI,LE,',9,8,,C'),',/,
C'OR,')),
HEADER1=(C'SORT FIELDS=(6,6,BI,A,632,8,BI,,A,,20,17,,BI,,A,
C'37,7,BI,D)',/,
C'OUTFIL FILES=01,',/,
C'INCLUDE=(005,001,CH,EQ,C''',C'0',C''',',/,
C'OR,'),
TRAILER1=(C'005,001,,CH,EQ,C''',C'9',''')')
|
I have assumed the key length in control card to be 8.
Thanks
Devil13 |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Devil_13,
Why would there be a key? |
|
Back to top |
|
|
Devil_13
New User
Joined: 17 Mar 2015 Posts: 2 Location: India
|
|
|
|
Hi Bill,
I meant the content of the control card:
Code: |
012345001 029820000 9
100018369 102347359 9
|
Since these will be part of the include condition i mentioned them as keys. probably a range of account numbers or any unique identifiers i guess
Thanks
Devil13 |
|
Back to top |
|
|
|
|