|
|
| Author |
Message |
CyberKannan
New User
Joined: 08 Feb 2008 Posts: 5 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: 1088 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: 5 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: 1088 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: 3900 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: 5 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: 3900 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: 5 Location: Chennai
|
|
|
|
Thanks Frank.
Thanks |
|
| Back to top |
|
 |
Skolusu
DFSORT Developer
Joined: 07 Dec 2007 Posts: 209 Location: San Jose
|
|
|
|
cyberkannan,
The following DFSORT JCL will give you the desired results
| Code: |
//STEP0100 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=YOUR input file,
// DISP=SHR
//SORTOUT DD DSN=Your output file,
// DISP=(NEW,CATLG,DELETE),
// UNIT=SYSDA,
// SPACE=(CYL,(X,Y),RLSE)
//SYSIN DD *
INREC IFTHEN=(WHEN=INIT,OVERLAY=(15:20X'00')),
IFTHEN=(WHEN=(11,4,ZD,EQ,01),OVERLAY=(15:C'1')),
IFTHEN=(WHEN=(11,4,ZD,EQ,02),OVERLAY=(15:01X'00',C'1')),
IFTHEN=(WHEN=(11,4,ZD,EQ,03),OVERLAY=(15:02X'00',C'1')),
IFTHEN=(WHEN=(11,4,ZD,EQ,04),OVERLAY=(15:03X'00',C'1')),
IFTHEN=(WHEN=(11,4,ZD,EQ,05),OVERLAY=(15:04X'00',C'1')),
IFTHEN=(WHEN=(11,4,ZD,EQ,06),OVERLAY=(15:05X'00',C'1')),
IFTHEN=(WHEN=(11,4,ZD,EQ,07),OVERLAY=(15:06X'00',C'1')),
IFTHEN=(WHEN=(11,4,ZD,EQ,08),OVERLAY=(15:07X'00',C'1')),
IFTHEN=(WHEN=(11,4,ZD,EQ,09),OVERLAY=(15:08X'00',C'1')),
IFTHEN=(WHEN=(11,4,ZD,EQ,10),OVERLAY=(15:09X'00',C'1')),
IFTHEN=(WHEN=(11,4,ZD,EQ,11),OVERLAY=(15:10X'00',C'1')),
IFTHEN=(WHEN=(11,4,ZD,EQ,12),OVERLAY=(15:11X'00',C'1')),
IFTHEN=(WHEN=(11,4,ZD,EQ,13),OVERLAY=(15:12X'00',C'1')),
IFTHEN=(WHEN=(11,4,ZD,EQ,14),OVERLAY=(15:13X'00',C'1')),
IFTHEN=(WHEN=(11,4,ZD,EQ,15),OVERLAY=(15:14X'00',C'1')),
IFTHEN=(WHEN=(11,4,ZD,EQ,16),OVERLAY=(15:15X'00',C'1')),
IFTHEN=(WHEN=(11,4,ZD,EQ,17),OVERLAY=(15:16X'00',C'1')),
IFTHEN=(WHEN=(11,4,ZD,EQ,18),OVERLAY=(15:17X'00',C'1')),
IFTHEN=(WHEN=(11,4,ZD,EQ,19),OVERLAY=(15:18X'00',C'1')),
IFTHEN=(WHEN=(11,4,ZD,EQ,20),OVERLAY=(15:19X'00',C'1'))
SORT FIELDS=(1,9,CH,A)
SUM FIELDS=(15,8,23,8,31,4),FORMAT=BI
/* |
Hope this helps....
Cheers |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Moderator
Joined: 15 Feb 2005 Posts: 3900 Location: San Jose, CA
|
|
|
|
Kannan,
Kolusu has a different interpretation of what you want then I did. Hopefully, he's right about what you want. If not, then please be more specific about what exactly you want to be "dynamic". |
|
| Back to top |
|
 |
CyberKannan
New User
Joined: 08 Feb 2008 Posts: 5 Location: Chennai
|
|
|
|
Kolusu,
Thanks a Ton. Amazing logic :-). I would like to know that my requirement has been solved using this sort card. Thanks Again.
Frank,
The sort card solved my requirement perfectly. Actually By Dynamic I mean, instead of writing 20 different IFTHEN, is there any possibility to have one IFTHEN which solves the same purpose.
Let me explain clearly about what I meant by "Dynamic".
| Code: |
| IFTHEN=(WHEN=(11,4,ZD,EQ,02),OVERLAY=(15:01X'00',C'1')), |
In the above sort card,
the character '1' is overlayed on position 15+01, if the value of position (11-15) is equals 02. And the same character '1' is overlayed on position 15+02 , if the value of postition (11-15) equals 03 and so on....
The overlay character is constant and only the overlay character position is varying based on the values in position 11-15.
So I just wanted to know, is there any possibility to write one line of sort card to handle this changing overlay position instead of writing multiple IFTHEN's. Hope i made myself clear about what i meant by "Dynamic".
Kindly let me know if there is any possibilty. Just a curiosity to know this :-)
Thanks |
|
| Back to top |
|
 |
|
|
|