| Author |
Message |
CyberKannan
New User
Joined: 08 Feb 2008 Posts: 4 Location: Chennai
|
|
|
|
Hi All
My requirement is below:
Prepare an output file based on the values from input file fields.
The last field in output file is a Group Field which consists of 20 positions. If the input record contains 0001, the first position will be 1 and the remaining 19 positions will be dots.
Input File:
XXX-XX-XXXX X 0001
XXX-XX-XXXX X 0002
XXX-XX-XXXX X 0020
Output File:
XXX-XX-XXXX X 1...................
XXX-XX-XXXX X .1..................
XXX-XX-XXXX X ...................1
Can anyone help me out in doing this requirement in DFSORT?
Thanks
Kannan |
|
| Back to top |
|
 |
References
|
Posted: Fri May 09, 2008 4:12 pm Post subject: Re: DFSORT + Prepare output file using input file values |
 |
|
|
 |
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 956 Location: At my desk
|
|
|
|
Something like 20 IFTHEN Builds?
Have you looked at the manual? |
|
| Back to top |
|
 |
CyberKannan
New User
Joined: 08 Feb 2008 Posts: 4 Location: Chennai
|
|
|
|
Hi
Am able to do that with 20 IFTHEN like using following SORT card.
Sort card:
| Code: |
INREC IFTHEN=(WHEN=INIT,OVERLAY=(15:20C'.'),HIT=NEXT),
IFTHEN=(WHEN=(11,4,CH,EQ,C'0001'),OVERLAY=(15:1C'1')),
IFTHEN=(WHEN=(11,4,CH,EQ,C'0002'),OVERLAY=(16:1C'1')),
IFTHEN=(WHEN=(11,4,CH,EQ,C'0003'),OVERLAY=(17:1C'1')),
IFTHEN=(WHEN=(11,4,CH,EQ,C'0004'),OVERLAY=(18:1C'1')),
IFTHEN=(WHEN=(11,4,CH,EQ,C'0005'),OVERLAY=(19:1C'1')),
IFTHEN=(WHEN=(11,4,CH,EQ,C'0006'),OVERLAY=(20:1C'1')),
IFTHEN=(WHEN=(11,4,CH,EQ,C'0007'),OVERLAY=(21:1C'1')),
IFTHEN=(WHEN=(11,4,CH,EQ,C'0008'),OVERLAY=(22:1C'1')),
IFTHEN=(WHEN=(11,4,CH,EQ,C'0009'),OVERLAY=(23:1C'1')),
IFTHEN=(WHEN=(11,4,CH,EQ,C'0010'),OVERLAY=(24:1C'1')),
IFTHEN=(WHEN=(11,4,CH,EQ,C'0011'),OVERLAY=(25:1C'1')),
IFTHEN=(WHEN=(11,4,CH,EQ,C'0012'),OVERLAY=(26:1C'1')),
IFTHEN=(WHEN=(11,4,CH,EQ,C'0013'),OVERLAY=(27:1C'1')),
IFTHEN=(WHEN=(11,4,CH,EQ,C'0014'),OVERLAY=(28:1C'1')),
IFTHEN=(WHEN=(11,4,CH,EQ,C'0015'),OVERLAY=(29:1C'1')),
IFTHEN=(WHEN=(11,4,CH,EQ,C'0016'),OVERLAY=(30:1C'1')),
IFTHEN=(WHEN=(11,4,CH,EQ,C'0017'),OVERLAY=(31:1C'1')),
IFTHEN=(WHEN=(11,4,CH,EQ,C'0018'),OVERLAY=(32:1C'1')),
IFTHEN=(WHEN=(11,4,CH,EQ,C'0019'),OVERLAY=(33:1C'1')),
IFTHEN=(WHEN=(11,4,CH,EQ,C'0020'),OVERLAY=(34:1C'1'))
SORT FIELDS=COPY
OUTREC BUILD=(1,10,15,65)
|
Input File:
22222222210001
11111111110002
55555555510003
33333333310004
44444444410005
77777777710006
66666666610007
Output File
22222222211...................
1111111111.1..................
5555555551..1.................
3333333331...1................
4444444441....1...............
7777777771.....1..............
6666666661......1.............
But I want to do it dynamically without using 20 IFTHEN. The sort card looks big n redundant. I hope there is some other better method than this. Please let me know if there is anything.
Thanks
Kannan |
|
| Back to top |
|
 |
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 956 Location: At my desk
|
|
|
|
Sharp solution, cleaner than the one I was thinking of.....
Are you inferring that there will be more than just the 20 positions?
Maybe Frank or Kolusu will come up with something..... |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Moderator
Joined: 15 Feb 2005 Posts: 3777 Location: San Jose, CA
|
|
|
|
| Quote: |
| But I want to do it dynamically without using 20 IFTHEN. The sort card looks big n redundant. I hope there is some other better method than this. Please let me know if there is anything. |
Depends on what you mean by more dynamically. We could generate the IFTHEN clauses so you don't have to handcode them, but that would still require using the IFTHEN clauses.
Mathematically, it could be done using exponents, but DFSORT doesn't support exponents.
| Quote: |
| Are you inferring that there will be more than just the 20 positions? |
Are you? |
|
| Back to top |
|
 |
CyberKannan
New User
Joined: 08 Feb 2008 Posts: 4 Location: Chennai
|
|
|
|
Frank actually, I mean to generate dynamically the sort card with one or two lines. Because if we see the sort card, the sort card contains
IFTHEN=(WHEN=(11,4,CH,EQ,C'0001'),OVERLAY=(15:1C'1'))
Here, I thought it is possible to make the overlay position(In the above line it is 15) dynamically. It is always value of field from position 11 to 4 plus 14. So I thought there might some other thing which I can do, to make it dynamically. But It seems, not.
Also it would be helpful if you can help me in similar requirement. Actually that is my actual requirement.
I want to generate a output file like the following from the input file given below:
Output File:
11111111111..................
222222222.111................
333333333..1111..............
Input File
1111111110001
1111111110002
2222222220002
2222222220003
2222222220004
3333333330003
3333333330004
3333333330005
3333333330006
I mean, the first 9 bytes are Key and I want to generate a bit map kind of thing using the values given in field position 10-13. If the same key has two rows with values 2 and 3, then I want to generate a single row with the key value and bitmap like .11.................
Hope I made myself clear about my requirement. Please let me know whether it is possible using DFSORT, so that I can avoid writing one COBOL program for this kind of requirement.
Thanks a Ton, |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Moderator
Joined: 15 Feb 2005 Posts: 3777 Location: San Jose, CA
|
|
|
|
| Quote: |
| Here, I thought it is possible to make the overlay position(In the above line it is 15) dynamically. It is always value of field from position 11 to 4 plus 14. So I thought there might some other thing which I can do, to make it dynamically. |
You could do that using DFSORT's arithmetic functions to calculate the overlay position and dynamically create a control statement with that position in it.
I could probably show you how to do what you want with multiple IFTHEN statements, but I really don't have time to work out the dynamic "method". Maybe Kolusu would have time, but he's taken the afternoon off, so it would be Monday before he got to it. I'll send him a note about it. |
|
| Back to top |
|
 |
CyberKannan
New User
Joined: 08 Feb 2008 Posts: 4 Location: Chennai
|
|
|
|
Thanks Frank.
Thanks |
|
| Back to top |
|
 |
|
|
|