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

creating the same record and merging them


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

New User


Joined: 27 Oct 2005
Posts: 24

PostPosted: Mon Jan 18, 2010 11:29 pm
Reply with quote

Hi ,

I have a requirement as follows:

From one of the program i got the output file having the following fields with values as

Name : paul
Merchant : More Inc
Tran Code : 263
Description : retailer

In the file it looks like as below

Code:

PAUL      DOCKERS   101RETAILER
PAUL      MOREINC   263RETAILER
CHRIS    MOREINC   264RETAILER
STEEVE  MOREINC   265RETAILER
COLIN    MOREINC   266RETAILER
PAUL      DOCKERS   301RETAILER


Now i want to read this file and for each tran code 263 with the same record with only change as trancode 63 similarly for TC264 a new record with TC64,similarly for TC265 a new record with TC58 and similarly for TC266 a new record with TC59, means the output file should be like as follows:

Code:

PAUL      MOREINC   063RETAILER
CHRIS    MOREINC   064RETAILER
STEEVE  MOREINC   058RETAILER
COLIN    MOREINC   059RETAILER


means the original file should not be rewritten with the above new tran codes, a new file should be created with the above details.

Could you please help me and provide me the code in ICETOOL / DFSORT.

Thanks in advance.

Thanks
Nagaraja
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: Mon Jan 18, 2010 11:53 pm
Reply with quote

You can use a DFSORT job like the following to do what you asked for. I assumed your input file has RECFM=FB and LRECL=80, but the job can be changed appropriately for other attributes.

Code:

//S1    EXEC  PGM=SORT
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
PAUL      DOCKERS   101RETAILER
PAUL      MOREINC   263RETAILER
CHRIS    MOREINC   264RETAILER
STEEVE  MOREINC   265RETAILER
COLIN    MOREINC   266RETAILER
PAUL      DOCKERS   301RETAILER
/*
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
   OPTION COPY
   INCLUDE COND=(1,80,SS,EQ,C'263',OR,
     1,80,SS,EQ,C'264',OR,
     1,80,SS,EQ,C'265',OR,
     1,80,SS,EQ,C'266')
   INREC FINDREP=(INOUT=(C'263',C'063',C'264',C'064',
     C'265',C'058',C'266',C'059'))
/*
Back to top
View user's profile Send private message
pnkumar
Warnings : 2

New User


Joined: 27 Oct 2005
Posts: 24

PostPosted: Tue Jan 19, 2010 6:52 pm
Reply with quote

HI Frank Yaeger,

Thanks a lot.

my requirement is some what different. I am explaining again as follows:

My file length is 458 bytes and it's record format is FB. The following is the layout of the fields. ( i cannot provide the entire layout so the remaining fields as mentioned with dots and the last filed is shown after dots).

Code:

--------- FIELD LEVEL/NAME ---------- -PICTURE- -NUMBER START     END  LENGTH 
:GQPT:-MONETARY-TXN                                         1     458     458 
3 FILLER                              X(31)          1      1      31      31 
3 :GQPT:-MT-EFF-DATE                  S9(7)          2     32      35       4 
3 :GQPT:-MT-TYPE                      X              3     36      36       1 
3 :GQPT:-MT-TXN-CODE                  S999           4     37      38       2 
3 :GQPT:-MT-AMOUNT                    S9(17)         5     39      47       9 
3 :GQPT:-MT-UNIT-PRICE                S9(17)         6     48      56       9 
3 :GQPT:-MT-BATCH-DATE                S9(7)          7     57      60       4 
.
.
.
3 FILLER                              X(32)         14    427     458      32 



The following is the record in the file.
Code:

FILLER                          :GQPT:-MT-EFF-DATE :GQPT:-MT-TYPE   :GQPT:-MT-TXN-CODE  ........ FILLER
31/AN                           4/PS               1/AN                  2/PS                        32/AN
(1-31)                          (32-35)            (36-36)               (37-38)                     (427-458)
1------------------------------ 2----------------- 3--------------------4-----------------  ........----14-------               
********************************* TOP OF DATA **********************-CAPS OFF-*
470000000000612000004400000471M            2010093 D                      123                           
470000000000612000004400000471M            2010093 D                      263                           
470000000000612000004400000471M            2010093 D                      264     
470000000000612000004500000471M            2010093 D                      263


Now i would like to create an output file by reading the above input file where the transaction code which is a packed decimal 263 will be included and the output record should contain the same record of the input record with only difference will be the transaction code 263 should be changed to 63. The output file should contain the following record.

Code:


FILLER                          :GQPT:-MT-EFF-DATE :GQPT:-MT-TYPE   :GQPT:-MT-TXN-CODE ......... FILLER
31/AN                           4/PS               1/AN                  2/PS                        32/AN         
(1-31)                          (32-35)            (36-36)               (37-38)                (427-458)       
1------------------------------ 2----------------- 3--------------------4----------------- .........----14--                 
********************************* TOP OF DATA **********************-CAPS OFF-*
470000000000612000004400000471M            2010093 D                      63   
470000000000612000004500000471M            2010093 D                      63


Please help me to achieve this using ICETOOL / DFSORT. Thanks in advance

Thanks
Nagaraja
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: Tue Jan 19, 2010 10:57 pm
Reply with quote

S999 is NOT packed decimal - it's zoned decimal. Packed decimal would be S999 COMP-3. Since you have the transaction code in positions 37-38, it obviously can't be a 3-byte ZD value, so I'll assume it's a 2-byte PD value. If so, you can use a DFSORT job like this:

Code:

//S1    EXEC  PGM=SORT
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (FB/458)
//SORTOUT DD DSN=...  output file (FB/458)
//SYSIN    DD    *
  OPTION COPY
  INCLUDE COND=(37,2,PD,EQ,263)
  INREC OVERLAY=(37:+63,TO=PD,LENGTH=2)
/*
Back to top
View user's profile Send private message
pnkumar
Warnings : 2

New User


Joined: 27 Oct 2005
Posts: 24

PostPosted: Wed Jan 20, 2010 10:07 am
Reply with quote

Hi Frank Yaeger,

Thanks a lot, it's working fine. As you assumed that the tran code is a S999 comp-3 field , the above layout was shown from the file-Aid. The below is from the record layout.

Code:

012700     03  :GQPT:-MT-TXN-CODE  PIC S9(03)      COMP-3.




Thanks a lot for your timely help.

Thanks& Regards,
Nagaraja
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 10
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts To find whether record count are true... DFSORT/ICETOOL 6
No new posts Validating record count of a file is ... DFSORT/ICETOOL 13
Search our Forums:

Back to Top