Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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
View previous topic :: :: View next topic  
Author Message
CyberKannan

New User


Joined: 08 Feb 2008
Posts: 5
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

CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2150
Location: At my coffee table

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: 5
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: 2150
Location: At my coffee table

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: 7130
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: 5
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: 7130
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: 5
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
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Mon May 12, 2008 9:55 pm    Post subject: Reply to: DFSORT + Prepare output file using input file valu
Reply with quote

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

DFSORT Moderator


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

PostPosted: Mon May 12, 2008 10:30 pm    Post subject:
Reply with quote

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

New User


Joined: 08 Feb 2008
Posts: 5
Location: Chennai

PostPosted: Tue May 13, 2008 3:04 pm    Post subject:
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Subtract the ZD fields to provide neg... Balaryan DFSORT/ICETOOL 4 Wed Oct 11, 2017 10:51 pm
No new posts Extend the decimal values in DIVISION Balaryan DFSORT/ICETOOL 3 Thu Oct 05, 2017 4:05 pm
No new posts Execute JCL step based on the content... sprikitik JCL & VSAM 2 Tue Oct 03, 2017 10:03 am
This topic is locked: you cannot edit posts or make replies. PS file data should be passed as symb... d_sarlie JCL & VSAM 15 Tue Oct 03, 2017 5:18 am
No new posts Where is output from PARM ABEXIT (SNA... packerm CA Products 3 Thu Sep 28, 2017 4:06 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us