Portal | IBM Manuals | Downloads | Products | Refer | Info | Programs | JCLs | Forum Rules*| Site Map | Mainframe CD 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index
 
Register
 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index FAQ Search Memberlist Usergroups Profile Log in to check your private messages Log in
 
DFSORT + Prepare output file using input file values

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
Author Message
CyberKannan

New User


Joined: 08 Feb 2008
Posts: 4
Location: Chennai

PostPosted: Fri May 09, 2008 4:12 pm    Post subject: DFSORT + Prepare output file using input file values
Reply with quote

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
View user's profile Send private message
References
PostPosted: Fri May 09, 2008 4:12 pm    Post subject: Re: DFSORT + Prepare output file using input file values Reply with quote

CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 956
Location: At my desk

PostPosted: Fri May 09, 2008 5:01 pm    Post subject:
Reply with quote

Something like 20 IFTHEN Builds?
Have you looked at the manual?
Back to top
View user's profile Send private message
CyberKannan

New User


Joined: 08 Feb 2008
Posts: 4
Location: Chennai

PostPosted: Fri May 09, 2008 5:06 pm    Post subject: Reply to: DFSORT + Prepare output file using input file valu
Reply with quote

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
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 956
Location: At my desk

PostPosted: Fri May 09, 2008 5:16 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 3777
Location: San Jose, CA

PostPosted: Fri May 09, 2008 10:14 pm    Post subject:
Reply with quote

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
View user's profile Send private message
CyberKannan

New User


Joined: 08 Feb 2008
Posts: 4
Location: Chennai

PostPosted: Fri May 09, 2008 11:51 pm    Post subject: Reply to: DFSORT + Prepare output file using input file valu
Reply with quote

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. icon_sad.gif

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
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 3777
Location: San Jose, CA

PostPosted: Sat May 10, 2008 2:06 am    Post subject:
Reply with quote

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
View user's profile Send private message
CyberKannan

New User


Joined: 08 Feb 2008
Posts: 4
Location: Chennai

PostPosted: Sat May 10, 2008 5:47 am    Post subject:
Reply with quote

Thanks Frank.

Thanks
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1