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

Convert single row multi cols to single col multi rows


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

New User


Joined: 10 Nov 2015
Posts: 44
Location: USA

PostPosted: Wed May 03, 2023 12:13 am
Reply with quote

Team - I am working on converting file that has a single row with multiple columns into 2 files having multiple rows with single column.

Source/Input file Layout is as below,
Code:

01 TOP-REC.
     05 PROC-TYPES PIC X(40).
     05 OCCURS-TABLE1.
       10 IMP1 OCCURS 200.
          15 IMPE1         PIC 9(05).
          15 FILLER                      PIC X(01).
     05 OCCURS-TABLE2.
       10 IMP2 OCCURS 200.
          15 IMPE2         PIC 9(05).
          15 FILLER                      PIC X(01).


Input file contains only a single record. For further processing, I need to convert a single record into 2 files containing multiple records.

File 1 should have all the IMPE1(5 bytes) one below other.
File 2 should have all the IMPE2(5 bytes) one below other.

I am able to achieve conversion from a single row multiple columns to a single column multiple row using COBOL.

I was wondering if there a way to achieve this using SORT but without using a big SYSIN card.

Constructive feedback appreciated.
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 792
Location: Pennsylvania

PostPosted: Wed May 03, 2023 12:50 am
Reply with quote

The best thing you could provide is an example of INPUT and OUTPUT data.
Back to top
View user's profile Send private message
elixir1986
Warnings : 1

New User


Joined: 10 Nov 2015
Posts: 44
Location: USA

PostPosted: Wed May 03, 2023 1:01 am
Reply with quote

Sure thing.

Input - contains only 1 record.
Code:

Column 1-40 -> Daskosia01Daskosia02Daskosia03Daskosia04
Column 41-45 -> 00000
Column 46 -> Space
Column 47-51 -> 00003
Column 52 -> Space
...
...
...
Column 2435-2439 -> 79999
Column 2440 -> Space


Output - Should contain only 1 column but multiple records(say record length = 5)
Code:

00000
00003
....
....
79999

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: Wed May 03, 2023 1:44 am
Reply with quote

How about BUILD with / (ie new line)?
Back to top
View user's profile Send private message
elixir1986
Warnings : 1

New User


Joined: 10 Nov 2015
Posts: 44
Location: USA

PostPosted: Wed May 03, 2023 3:41 am
Reply with quote

Would that mean using '/' 398 times (199 for each file) in the BUILD? That would make SYSIN card big. Wondering if there is any easier way to do this using SORT.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3053
Location: NYC,USA

PostPosted: Wed May 03, 2023 6:43 am
Reply with quote

ibmmainframes.com/about62609.html
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


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

PostPosted: Wed May 03, 2023 11:18 am
Reply with quote

Maybe this one is what's requested.

Code:
//WHATEVER EXEC PGM=ICETOOL                                       
//TOOLMSG  DD SYSOUT=*                                             
//DFSMSG   DD SYSOUT=*                                             
//SYSUDUMP DD SYSOUT=*                                             
//IN       DD *                                                   
Daskosia01Daskosia02Daskosia03Daskosia0400000 00003 79999         
/*                                                                 
//#1       DD DISP=(NEW,PASS),UNIT=SYSALLDA,SPACE=(CYL,(2,1))     
//#2       DD DISP=(NEW,PASS),UNIT=SYSALLDA,SPACE=(CYL,(2,1))     
//OUT      DD SYSOUT=*                                             
//TOOLIN   DD *                                                   
  COPY FROM(IN) TO(#1) USING(PRSE)                                 
  RESIZE FROM(#1) TO(#2) TOLEN(5)                                 
  COPY FROM(#2) TO(OUT) USING(LAST)                               
/*                                                                 
//PRSECNTL DD *                                                   
  INREC IFTHEN=(WHEN=INIT,                                         
    PARSE=(%=(FIXLEN=40),                                         
           %000=(STARTAT=NUM,FIXLEN=5,REPEAT=199)),               
    BUILD=(%000,%001,%002,%003,%004,%005,%006,%007,%008,%009,%010,
           %011,%012,%013,%014,%015,%016,%017,%018,%019,%020,%021,
           %022,%023,%024,%025,%026,%027,%028,%029,%030,%031,%032,
           %033,%034,%035,%036,%037,%038,%039,%040,%041,%042,%043,
           %044,%045,%046,%047,%048,%049,%050,%051,%052,%053,%054,
           %055,%056,%057,%058,%059,%060,%061,%062,%063,%064,%065,
           %066,%067,%068,%069,%070,%071,%072,%073,%074,%075,%076,
           %077,%078,%079,%080,%081,%082,%083,%084,%085,%086,%087,
           %088,%089,%090,%091,%092,%093,%094,%095,%096,%097,%098,
           %099,%100,%101,%102,%103,%104,%105,%106,%107,%108,%109,
           %110,%111,%112,%113,%114,%115,%116,%117,%118,%119,%120,
           %121,%122,%123,%124,%125,%126,%127,%128,%129,%130,%131,
           %132,%133,%134,%135,%136,%137,%138,%139,%140,%141,%142,
           %143,%144,%145,%146,%147,%148,%149,%150,%151,%152,%153,
           %154,%155,%156,%157,%158,%159,%160,%161,%162,%163,%164,
           %165,%166,%167,%168,%169,%170,%171,%172,%173,%174,%175,
           %176,%177,%178,%179,%180,%181,%182,%183,%184,%185,%186,
           %187,%188,%189,%190,%191,%192,%193,%194,%195,%196,%197,
           %198))                                                 
   END                           
 /*                               
 //LASTCNTL DD *                 
   OMIT COND=(1,5,CH,EQ,C' ')     
   END                           
 /*
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 get the count of rows for every 1 ... DB2 3
No new posts Need to convert date format DFSORT/ICETOOL 20
No new posts Exclude rows with > than x occurre... DFSORT/ICETOOL 6
No new posts How to append a PS file into multiple... JCL & VSAM 3
No new posts Keep leading zero(s) after convert fl... SYNCSORT 7
Search our Forums:

Back to Top