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
 
combine multiple lines to a single line

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
darkstar13

New User


Joined: 06 Nov 2008
Posts: 46
Location: Manila, Philippines

PostPosted: Fri Feb 05, 2010 7:34 am    Post subject: combine multiple lines to a single line
Reply with quote

Hi All,

I am trying to combine a file with multiple record layout ( 16 redefines to a 05 level working storage variable).

The file looks like this:
Code:
HDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
01BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
02CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
03DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
04EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
05FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
06GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
07HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
08IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
09JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ
10KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
11LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL
12MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
13NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
14OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
15PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP
16QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ


Record length is 101.

For my desired output, I want to combine those 17 lines into 1,
something like side by side splice, but I am having trouble.
Desired output LRECL will be 17 * 101 = 1717.
Code:
HDAAAAAAAAAAAAAA01BBBBBBBBBB.....16QQQQQQQQQQQ


Any suggestions on how to do it?
I am not familiar with splice, and that the sample i found only combines two lines..

Thanks alot.
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 Feb 05, 2010 8:54 am    Post subject:
Reply with quote

The "....." means row 02 to 15?
Why when row 02 is "BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB" long do you want the output for that row to be only "BBBBBBBBBB" long?
What is the maximum number of rows per each "HD", 16 or greater (or less?)?
Back to top
View user's profile Send private message
darkstar13

New User


Joined: 06 Nov 2008
Posts: 46
Location: Manila, Philippines

PostPosted: Fri Feb 05, 2010 10:29 am    Post subject:
Reply with quote

Hi CICS guy,

Quote:
The "....." means row 02 to 15?


yes, sorry for the confusion..

tardiness on my part to write the full record; no truncation will be done.
HD< 99 A's>01<99 B's> ... 16<99 Q's> - LRECL = 101 * 17 =1717.
Back to top
View user's profile Send private message
darkstar13

New User


Joined: 06 Nov 2008
Posts: 46
Location: Manila, Philippines

PostPosted: Fri Feb 05, 2010 10:38 am    Post subject:
Reply with quote

From my search here, I found a sort card that joins 2 files laterally.

For my task, I am thinking :
1. Extract record based on their record id (i.e. the first two bytes)
- i will then have a sort with SORTOF01 TO SORTOF17 ( 17 files)
2. By two's, join the records laterally
- join HD recs with 01 recs
02 recs with 03 recs
.
.
.
14 recs with 15 recs
16 recs
- i will then have 9 files on the first batch
3. Join the files again laterally... until I get one file.
- i will have 5 files on second batch
- i will have 3 files on the 3rd batch
- i will have two files on the 4th batch
- then finally one file with LRECL=1717.

But this looks sooooooooo tedious, and I am hoping there's someone out there who can give me an idea how to simplify this one.

Thanks.
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

PostPosted: Fri Feb 05, 2010 10:43 am    Post subject:
Reply with quote

Hi,

REXX might a better option.


Gerry
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri Feb 05, 2010 10:47 am    Post subject:
Reply with quote

Hello,

This would be a "dink" with cobol. . . Maybe less than an hour's work. . .
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

PostPosted: Fri Feb 05, 2010 10:58 am    Post subject:
Reply with quote

Hi,

it's not the prettiest code but will do the trick

Code:
//GENER1   EXEC PGM=IEBGENER                                           
//SYSPRINT DD SYSOUT=*                                                 
//SYSIN    DD DUMMY                                                     
//SYSUT2   DD DSN=&&SYSPROC(MRGERECS),                                 
//            DISP=(,PASS),                                             
//            UNIT=VIO,                                                 
//            SPACE=(TRK,(1,1,1)),                                     
//            DCB=(RECFM=FB,LRECL=80)                                   
//SYSUT1   DD *,DLM='$$'                                               
/**** REXX ****/                                                       
TRACE O                                                                 
/*********************************************************************/
EOFFLAG     = 2               /* RETURN CODE TO INDICATE END-OF-FILE */
RETURN_CODE = 0               /* INITIALIZE RETURN CODE              */
IN_CNTR     = 0               /* INITIALIZE # OF LINES READ          */
OUT_CNTR    = 0               /* INITIALIZE # OF LINES WRITTEN       */
REC = ''
/*********************************************************************/
/* OPEN THE "DDNAME" FILE, BUT DO NOT READ ANY RECORDS YET. ALL      */
/* RECORDS WILL BE READ AND PROCESSED WITHIN THE LOOP BODY.          */
/*********************************************************************/
                                                                       
"EXECIO 0 DISKR "FILEIN" (OPEN"       /* OPEN "DDNAME"               */
                                                                       
/*********************************************************************/
/* NOW READ ALL LINES FROM "DDNAME" STARTING AT LINE 1.              */
/*********************************************************************/
                                                                       
DO WHILE (RETURN_CODE ¬= EOFFLAG)   /* LOOP WHILE NOT END-OF-FILE    */
   "EXECIO 1 DISKR FILEIN"          /* READ 1 LINE TO THE DATA STACK */
   RETURN_CODE = RC                 /* SAVE EXECIO RC                */
   IF RETURN_CODE = 0 THEN          /* GET A LINE OK?                */
      DO                            /* YES                           */
       IN_CNTR = IN_CNTR + 1        /* INCREMENT INPUT LINE CNTR     */
        PARSE PULL RECORD           /* PULL LINE JUST READ FROM STACK*/
                                                                       
   REC      = REC||RECORD                                               
                                                                       
 END                                                                   
END                                                                     
QUEUE REC                                                               
OUT_CNTR = OUT_CNTR + 1             /* INCREMENT INPUT LINE CNTR     */
SAY 'RECS READ =' IN_CNTR                                               
SAY 'RECS  OUT =' OUT_CNTR                                             
"EXECIO 0 DISKR FILEIN   (FINIS"    /* CLOSE THE INPUT FILE DDNAME   */
"EXECIO * DISKW MERGRECS (FINIS"    /* CLOSE THE INPUT FILE DDNAME   */
$$                                                                     
//*                                                                     
//**********************************************************************
//*                                                                     
//MERGRECS EXEC PGM=IKJEFT01,DYNAMNBR=30,                               
//            PARM=('MRGERECS')        /* REXNAME                       
//SYSPROC  DD DSN=&&SYSPROC,                                           
//            DISP=(SHR)                                         
//SYSTSPRT DD SYSOUT=*             
//FILEIN   DD DSN=input-file,DISP=SHR               
//SYSTSIN  DD DUMMY                                                     
//MERGRECS DD DSN=output-file,                                 
//            DISP=(,CATLG,DELETE),                                     
//            UNIT=SYSDA,                                               
//            SPACE=(TRK,(10,5),RLSE),                               
//            DCB=(RECFM=FB,LRECL=1717)                                 
//*                                                                     
//**********************************************************************



Gerry
Back to top
View user's profile Send private message
darkstar13

New User


Joined: 06 Nov 2008
Posts: 46
Location: Manila, Philippines

PostPosted: Fri Feb 05, 2010 11:09 am    Post subject:
Reply with quote

I modified my above steps to:
1. 1. Extract record based on their record id (i.e. the first two bytes)
- i will then have a sort with SORTOF01 TO SORTOF17 ( 17 files)
2. Use splice to merge the file:

Code:
  COPY FROM(FILEHD) TO(TMP1) USING(CTL1)                     
  COPY FROM(FILE01) TO(TMP1) USING(CTL2)                     
  COPY FROM(FILE02) TO(TMP1) USING(CTL3)                     
  COPY FROM(FILE03) TO(TMP1) USING(CTL4)                     
  COPY FROM(FILE04) TO(TMP1) USING(CTL5)                     
  COPY FROM(FILE05) TO(TMP1) USING(CTL6)                     
  COPY FROM(FILE06) TO(TMP1) USING(CTL7)                     
  COPY FROM(FILE07) TO(TMP1) USING(CTL8)                     
  COPY FROM(FILE08) TO(TMP1) USING(CTL9)                     
  COPY FROM(FILE09) TO(TMP1) USING(CT10)                     
  COPY FROM(FILE10) TO(TMP1) USING(CT11)                     
  COPY FROM(FILE11) TO(TMP1) USING(CT12)                     
  COPY FROM(FILE12) TO(TMP1) USING(CT13)                     
  COPY FROM(FILE13) TO(TMP1) USING(CT14)                     
  COPY FROM(FILE14) TO(TMP1) USING(CT15)                     
  COPY FROM(FILE15) TO(TMP1) USING(CT16)                     
  COPY FROM(FILE16) TO(TMP1) USING(CT17)                     
  SPLICE FROM(TMP1) TO(TREVMRG) ON(102,8,PD) USING(CT18)     
/*                                         
//CTL1CNTL  DD *                           
  OUTREC FIELDS=(1:1,101,102:SEQNUM,8,PD) 
//CTL2CNTL  DD *                           
  OUTREC FIELDS=(1:1,101,102:SEQNUM,8,PD) 
//CTL3CNTL  DD *                           
  OUTREC FIELDS=(1:1,101,102:SEQNUM,8,PD) 
//CTL4CNTL  DD *                           
  OUTREC FIELDS=(1:1,101,102:SEQNUM,8,PD) 
//CTL5CNTL  DD *                           
  OUTREC FIELDS=(1:1,101,102:SEQNUM,8,PD) 
//CTL6CNTL  DD *                           
  OUTREC FIELDS=(1:1,101,102:SEQNUM,8,PD) 
//CTL7CNTL  DD *                           
  OUTREC FIELDS=(1:1,101,102:SEQNUM,8,PD) 
//CTL8CNTL  DD *                           
  OUTREC FIELDS=(1:1,101,102:SEQNUM,8,PD) 
//CTL9CNTL  DD *                           
  OUTREC FIELDS=(1:1,101,102:SEQNUM,8,PD) 
//CT11CNTL  DD *                           
  OUTREC FIELDS=(1:1,101,102:SEQNUM,8,PD) 
//CT12CNTL  DD *                             
  OUTREC FIELDS=(1:1,101,102:SEQNUM,8,PD)     
//CT13CNTL  DD *                             
  OUTREC FIELDS=(1:1,101,102:SEQNUM,8,PD)     
//CT14CNTL  DD *                             
  OUTREC FIELDS=(1:1,101,102:SEQNUM,8,PD)     
//CT15CNTL  DD *                             
  OUTREC FIELDS=(1:1,101,102:SEQNUM,8,PD)     
//CT16CNTL  DD *                             
  OUTREC FIELDS=(1:1,101,102:SEQNUM,8,PD)     
//CT17CNTL  DD *                             
  OUTREC FIELDS=(1:1,101,102:SEQNUM,8,PD)     
//CT18CNTL  DD *                             
  OUTFIL FNAMES=TREVMRG,                     
  OUTREC=(1:1,101,                           
        102:1,101,                           
        203:1,101,                           
        304:1,101,                           
        405:1,101,                           
        506:1,101,                           
        607:1,101,       
        708:1,101,       
        809:1,101,       
        910:1,101,       
        1011:1,101,       
        1112:1,101,       
        1213:1,101,       
        1314:1,101,       
        1415:1,101,       
        1516:1,101,       
        1617:1,101)       
/*                                           


However, I am getting an error that I must have a WITH parameter on my splice, however I really have no idea what to put in there...


Code:
SYT053E  "SPLICE" STATEMENT DOES NOT CONTAIN A "WITH" OPERAND     
                                                                 
SYT004I  SYNCTOOL PROCESSING COMPLETED WITH RETURN CODE 12       


Note that I am a SPLICE newbie.. I am not sure how splice works..
Any corrections / suggestions / etc will be of great help. Thanks
Back to top
View user's profile Send private message
darkstar13

New User


Joined: 06 Nov 2008
Posts: 46
Location: Manila, Philippines

PostPosted: Fri Feb 05, 2010 11:17 am    Post subject:
Reply with quote

wow.. icon_surprised.gif
thanks gcicchet.. i hope i can delete my post above...icon_redface.gif
horrible splice code.

Thanks alot. I am not a REXX expert but I know just enough to code a few program. I hope I will be able to decipher your code.. icon_biggrin.gif icon_biggrin.gif icon_surprised.gif
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 -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts line 52: Name or string > 250 char... Ashishpanpaliya CLIST & REXX 5 Sat Oct 14, 2017 2:29 am
No new posts How to write Rexx program to size and... sreejeshcs CLIST & REXX 14 Thu Oct 12, 2017 7:26 am
No new posts ejck thru rexx to multiple jobs insid... Susanta All Other Mainframe Topics 5 Tue Sep 19, 2017 1:39 pm
No new posts More than 1 Include criteria for sing... Roy Ware SYNCSORT 6 Wed Sep 13, 2017 11:45 pm
No new posts PLI - printing from multiple programs Pedro PL/I & Assembler 8 Fri Sep 08, 2017 6:36 am

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