IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Sort input File FB=200


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
shrivatsa
Warnings : 1

Active User


Joined: 17 Mar 2006
Posts: 174
Location: Bangalore

PostPosted: Wed May 07, 2008 5:08 pm
Reply with quote

Frank,

I have a input File FB=200
Records like below
Code:
----+----1----+----2----+----3----+----4----+----5-
HEADER 20080424 IND             
20080423CAN380638  I04/25/2008CAR70
20080423CAN322156  I04/25/2008CARF4
20080423CAN322726  I04/25/2008CARF4
20080423CDN829228  I04/25/2008CDAV4
20080423CDN321708  I04/25/2008CDAFF4
20080423CON317303  I04/25/2008CBAF4
20080423CON322834  I04/25/2008CBAF4


I want the output like below
header changed to BAN
CAN changed to CTN and CAR changed to CYR
CDN changed to CSR and CDA changed to CGT
CON cahnged to CXT and CBA changed to NMF
Code:
----+----1----+----2----+----3----+----4----+----5-
HEADER 20080424 BAN             
20080423CTN380638  I04/25/2008CYR70
20080423CTN322156  I04/25/2008CYRF4
20080423CTN322726  I04/25/2008CARF4
20080423CSR829228  I04/25/2008CGTV4
20080423CSR321708  I04/25/2008CGTFF4
20080423CXT317303  I04/25/2008NMFF4
20080423CXT322834  I04/25/2008NMFF4
Back to top
View user's profile Send private message
CICS Guy

Senior Member


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

PostPosted: Wed May 07, 2008 8:06 pm
Reply with quote

No sort?
FB is the recfm.
What it the 200, block size or record length?
Either way, what is the lrecl and blksize?
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Wed May 07, 2008 9:42 pm
Reply with quote

It's not clear if you want to change CAN and CAR only if both appear in the record (if CAN and CAR appear in the record, change both) or independently (if CAN appears, change it. If CAR appears, change it). Assuming independence, here's a DFSORT job that will do what you asked for. If they're not independent, let me know.

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (FB/200)
//SORTOUT DD DSN=...  output file (FB/200)
//SYSIN    DD    *
  OPTION COPY
  INREC IFTHEN=(WHEN=(1,6,CH,EQ,C'HEADER'),
      OVERLAY=(17:C'BAN'),HIT=NEXT),
     IFTHEN=(WHEN=(9,3,CH,EQ,C'CAN'),
      OVERLAY=(9:C'CTN'),HIT=NEXT),
     IFTHEN=(WHEN=(31,3,CH,EQ,C'CAR'),
      OVERLAY=(31:C'CYR'),HIT=NEXT),
     IFTHEN=(WHEN=(9,3,CH,EQ,C'CDN'),
      OVERLAY=(9:C'CSR'),HIT=NEXT),
     IFTHEN=(WHEN=(31,3,CH,EQ,C'CDA'),
      OVERLAY=(31:C'CGT'),HIT=NEXT),
     IFTHEN=(WHEN=(9,3,CH,EQ,C'CON'),
      OVERLAY=(9:C'CXT'),HIT=NEXT),
     IFTHEN=(WHEN=(31,3,CH,EQ,C'CBA'),
      OVERLAY=(31:C'NMF'))
/*
Back to top
View user's profile Send private message
V S Amarendra Reddy

Active User


Joined: 13 Sep 2006
Posts: 216
Location: USA

PostPosted: Wed May 07, 2008 9:57 pm
Reply with quote

Frank,

I have coded the control card like this and its working fine.
Code:

//SYSIN    DD *                                                 
  OPTION COPY                                                   
  INREC IFTHEN=(WHEN=(1,6,CH,EQ,C'HEADER'),                     
        OVERLAY=(17:C'BAN')),                                   
        IFTHEN=(WHEN=NONE,                                       
        OVERLAY=(1,8,9:9,3,CHANGE=(3,C'CAN',C'CTN',C'CDN',C'CSR',
                 C'CON',C'CXT'),NOMATCH=(9,3),12,19,             
                 31:31,3,CHANGE=(3,C'CAR',C'CYR',C'CDA',C'CGT', 
                 C'CBA',C'NMF'),NOMATCH=(31,3),34,166))         
/*                                                               


Please let me know if it is ineffiecient.
or the problems that can be occured by this card.
Regards
Amar
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Wed May 07, 2008 10:18 pm
Reply with quote

Amar,

Yes, that's another way to do it providing the fields are independent.

However, since you're using OVERLAY, you don't have to specify the fields you're NOT changing (that's kind of the point of OVERLAY). So your OVERLAY operand should be:

Code:

     OVERLAY=(9:9,3,CHANGE=(3,C'CAN',C'CTN',C'CDN',C'CSR',
                 C'CON',C'CXT'),NOMATCH=(9,3),             
                 31:31,3,CHANGE=(3,C'CAR',C'CYR',C'CDA',C'CGT', 
                 C'CBA',C'NMF'),NOMATCH=(31,3)))       
Back to top
View user's profile Send private message
V S Amarendra Reddy

Active User


Joined: 13 Sep 2006
Posts: 216
Location: USA

PostPosted: Wed May 07, 2008 10:21 pm
Reply with quote

Great!!!

Thank you frank. I am clarified about overlay bit more.

Regards
Amar
Back to top
View user's profile Send private message
shrivatsa
Warnings : 1

Active User


Joined: 17 Mar 2006
Posts: 174
Location: Bangalore

PostPosted: Thu May 08, 2008 9:57 am
Reply with quote

Hi Frank,

There is slight change in the requirement as below, I am finding it difficult to control this type of complex requirement... Please help me out...

Code:
----+----1----+----2----+----3----+----4----+----5-
HEADER 20080424 IND             
20080423CAN380638 C ABCDI04/25/2008CAR70
20080423CAN322156 C DFEEI04/25/2008CARF4
20080423CAN322726 C DFEEI04/25/2008CARF4
20080423CAN829228 C RRTTI04/25/2008CARV4
20080423CAN321708 C DFEEI04/25/2008CARFF4
20080423CAN317303 C DFETI04/25/2008CARF4
20080423CAN322834 C DFETI04/25/2008CARF4


As there is CAN CAR combination is there in all the records
I need the output as
Header change as IND to BAN
For first 3 Records change should happen as CTN and CYR
Next 2 records change should happen as CSR and CGT
Next 2 records change should happen as CXT and NMF

All C is changed to G except for the DFEE and DFET Records

And in the other Output I need the Number of combination changed from
CAN CAR to CTN and CYR
CAN CAR to CSR and CGT
CAN CAR to CXT and NMF
and Number of Records C changed to G

Record count may change every time, So there must be some sort of count in the control card where I can change it every time and Run

In this example Its 3, 2 and 2 it may be next time 4, 5, 6 ....

Code:
----+----1----+----2----+----3----+----4----+----5-
HEADER 20080424 BAN             
20080423CTN380638 G ABCDI04/25/2008CYR70
20080423CTN322156 C DFEEI04/25/2008CYRF4
20080423CTN322726 C DFEEI04/25/2008CYRF4
20080423CSR829228 G RRTTI04/25/2008CGTV4
20080423CSR321708 C DFEEI04/25/2008CGTFF4
20080423CXT317303 C DFETI04/25/2008NMFF4
20080423CXT322834 C DFETI04/25/2008NMFF4
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Thu May 08, 2008 9:38 pm
Reply with quote

Here's a DFSORT job that will meet your new requirement. You just need to change the GP1END and GP2END values as the number of records in your groups change. So for example, for the 4,5,6 case, you would change GP1END to 5 and GP2END to 10 (remember to count the header record).

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SYMNAMES DD *
* Set GP1END +n value to relative record number of end of group 1
GP1END,+4
* Set GP2END +n value to relative record number of end of group 2
GP2END,+6
/*
//SORTIN DD DSN=...  input file (FB/200)
//SORTOUT DD DSN=...  output file (FB/200)
//SYSIN    DD    *
  OPTION COPY
  INREC IFOUTLEN=200,
     IFTHEN=(WHEN=INIT,OVERLAY=(201:SEQNUM,8,ZD)),
     IFTHEN=(WHEN=(1,6,CH,EQ,C'HEADER'),
      OVERLAY=(17:C'BAN'),HIT=NEXT),
     IFTHEN=(WHEN=(201,8,ZD,GE,+2,AND,21,4,SS,NE,C'DFEE,DFET'),
      OVERLAY=(19:C'G'),HIT=NEXT),
     IFTHEN=(WHEN=(201,8,ZD,GE,+2,AND,201,8,ZD,LE,GP1END),
      OVERLAY=(9:C'CTN',36:C'CYR')),
     IFTHEN=(WHEN=(201,8,ZD,GT,GP1END,AND,201,8,ZD,LE,GP2END),
      OVERLAY=(9:C'CSR',36:C'CGT')),
     IFTHEN=(WHEN=(201,8,ZD,GT,GP2END),
      OVERLAY=(9:C'CXT',36:C'NMF'))
/*
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Thu May 08, 2008 9:40 pm
Reply with quote

Quote:
And in the other Output I need the Number of combination changed from
CAN CAR to CTN and CYR
CAN CAR to CSR and CGT
CAN CAR to CXT and NMF
and Number of Records C changed to G


It's not clear to me what you're talking about here. Please explain more clearly what other Output you're referring to and what it should look like, what the input looks like, and what you mean by "CAN CAR to CTN and CYR", etc.
Back to top
View user's profile Send private message
shrivatsa
Warnings : 1

Active User


Joined: 17 Mar 2006
Posts: 174
Location: Bangalore

PostPosted: Fri May 09, 2008 12:13 pm
Reply with quote

Hi Frank,

Above JCL is working fine for me.. Excellent logic DFSORT is having in it and you are master in it...

The first out file is as per my requirement
Code:
//SORTOUT DD DSN=...  output file (FB/200)


The second output file is that I am talking about the changes got in the first output file by using the Input file
The number of records changed from CAN to CTN
and CAR to CYR

can I get the report in separate output file...

I think I am more clear now...
Back to top
View user's profile Send private message
V S Amarendra Reddy

Active User


Joined: 13 Sep 2006
Posts: 216
Location: USA

PostPosted: Fri May 09, 2008 8:25 pm
Reply with quote

No Not yet.

Quote:
The second output file is that I am talking about the changes got in the first output file by using the Input file
The number of records changed from CAN to CTN
and CAR to CYR


Means is that enough to get the cound of CAN to CTN and CAR to CYR.
You don't need the count of CAN to CSR and CAR to CGT ,
then CAN to CXT and CAR to NMF
then number of records that changed from 'C' to 'G'.

Please post all the counts you require in the another output file.

Regards
Amar.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Fri May 09, 2008 9:11 pm
Reply with quote

Quote:
I think I am more clear now...


It's not clear to me. Please start over for this requirement and give the complete details - example of input records and expected output records, "rules" for getting from input to output, etc.
Back to top
View user's profile Send private message
shrivatsa
Warnings : 1

Active User


Joined: 17 Mar 2006
Posts: 174
Location: Bangalore

PostPosted: Sat May 10, 2008 12:00 am
Reply with quote

Frank,

What erver the sort control card is given by you is going to do the sort and do the modification of the input file.

The selection of particular Record types will be in the sysout
For Example

in sysout it will be metioned as INREC 20 outrec 15
For particular record type CAN and CAR combination

I need the Record counts changed by the above control card in separate output file.... Is it clear now and is it possible...
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Sat May 10, 2008 2:09 am
Reply with quote

No, it's not clear. I need what I asked for in my previous post to understand what you're trying to do.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 9
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Access to non cataloged VSAM file JCL & VSAM 18
No new posts Need help for File Aid JCL to extract... Compuware & Other Tools 23
Search our Forums:

Back to Top