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

Merge 2 lines based on Space from a Single file


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Srinivasan Selvam

New User


Joined: 25 May 2012
Posts: 11
Location: india

PostPosted: Thu Oct 20, 2022 11:12 am
Reply with quote

Hi all,
We have a input file, which is like below.
Code:

<NAME1> <NAME 2>            <RECORD1>   <RECORD2>           <MATCH IND>
TABLE 1   TABLE 1            10                 10                  Y
TABLE 2   TABLE 2            30                 30                  Y
TABLE 3   TABLE 3            401               401                  Y
TABLE 4   TABLE 4            105               105                  Y
TABLE 5                       10                                    N
          TABLE 5                               15                  N
TABLE 6   TABLE 6            101               101                  Y


NAME 1 - 40 bytes
NAME 2 - 40 bytes
Record 1 - 10 bytes
Record 2 - 10 bytes
Match Ind - 2 bytes

I would like to have the output as below.
Code:

TABLE 1   TABLE 1            10                 10                    Y
TABLE 2   TABLE 2            30                 30                    Y
TABLE 3   TABLE 3            401               401                    Y
TABLE 4   TABLE 4            105               105                    Y
TABLE 5   TABLE 5            10                 15                    N
TABLE 6   TABLE 6            101               101                    Y


Suggestions please on how to achieve this.
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1295
Location: Bamberg, Germany

PostPosted: Thu Oct 20, 2022 11:47 am
Reply with quote

Code:
//WHATEVER EXEC PGM=ICEMAN                                             
//SORTIN   DD *                                                       
<NAME1> <NAME 2>            <RECORD1>   <RECORD2>           <MATCH IND>
TABLE 1   TABLE 1            10                 10                  Y 
TABLE 2   TABLE 2            30                 30                  Y 
TABLE 3   TABLE 3            401               401                  Y 
TABLE 4   TABLE 4            105               105                  Y 
TABLE 5                       10                                    N 
          TABLE 5                               15                  N 
TABLE 6   TABLE 6            101               101                  Y 
/*                                                                     
//SYSOUT   DD SYSOUT=*                                                 
//SORTOUT  DD SYSOUT=*                                                 
//SYSIN    DD *                                                       
  OPTION COPY                                                         
  OMIT COND=(1,1,CH,EQ,C'<')                                           
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,7,CH,NE,C' '),PUSH=(1,7))         
  OUTFIL FNAMES=(SORTOUT),                                             
    REMOVECC,NODETAIL,                                                 
    SECTIONS=(1,7,                                                     
      TRAILER3=(1,28,TOT=(30,10,SFF),X,TOT=(41,10,SFF),51,19))         
  END                                                                 
/*
Back to top
View user's profile Send private message
Srinivasan Selvam

New User


Joined: 25 May 2012
Posts: 11
Location: india

PostPosted: Thu Oct 20, 2022 4:17 pm
Reply with quote

Hi Joerg,

Actually there was no record in input file having value within <>.
That's for showing the input layout.

Input layout is

Code:
Table details from file 1 - 40 bytes
Space
Table details file file 2 - 40 bytes
Space
Table record count from file 1 - 10 bytes
Table record count from file 2 - 10 bytes
Space
Matching indicator - 1 byte


So LRECL of input file is FB/104.

Sorry for the confusion.
Back to top
View user's profile Send private message
dneufarth

Active User


Joined: 27 Apr 2005
Posts: 420
Location: Inside the SPEW (Southwest Ohio, USA)

PostPosted: Thu Oct 20, 2022 5:24 pm
Reply with quote

Srinivas,

Did you try Joerg’s solution?
Back to top
View user's profile Send private message
Srinivasan Selvam

New User


Joined: 25 May 2012
Posts: 11
Location: india

PostPosted: Thu Oct 20, 2022 6:49 pm
Reply with quote

Hi Joerg / Dave,
I have modified the code and finally the output came as expected.
Thanks!.

Code:
//SYSIN    DD *                                                 
  OPTION COPY                                                   
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,40,CH,NE,C' '),PUSH=(1,40))
   OUTFIL FNAMES=(SORTOUT),                                     
     REMOVECC,NODETAIL,                                         
     SECTIONS=(1,40,                                           
       TRAILER3=(1,70,TOT=(81,10,SFF),TOT=(91,10,SFF),103,1))   
  END                                                           
/*                                                             
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2081
Location: USA

PostPosted: Thu Oct 20, 2022 11:41 pm
Reply with quote

Srinivasan Selvam wrote:
Hi Joerg / Dave,
I have modified the code and finally the output came as expected.
Thanks!.

You've demonstrated good results in arithmetic calculations, between 1 and 100! icon_lol.gif
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 To Omit records based n SORT condition DFSORT/ICETOOL 6
No new posts Format Binary file to EBCDIC JCL & VSAM 4
No new posts Binary File format getting change whi... All Other Mainframe Topics 7
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
Search our Forums:

Back to Top