Reformat dynamic rows to columns



JES, JES2, JCL utilities, IDCAMS, Compile & Run JCLs, PROCs etc...

Reformat dynamic rows to columns

Postby Aech » Wed Dec 01, 2021 8:20 pm

Hi,

I have data which looks like below

Job1    Description1    Monday
Job2    Description2    Friday
Job3    Description3    Monday
                        Thursday
Job4    Description4    Monday
Job4    Description4    Tuesday
                        Wednesday
                        Thursday
                        Friday
Job5    Description5    Sunday


I want write out an report in a single row like below

Job1    Description1    Monday
Job2    Description2    Friday
Job3    Description3    Monday  Thursday
Job4    Description4    Monday  Tuesday   Wednesday   Thursday    Friday
Job5    Description5    Sunday
 


But I am not sure which option to use for this, could someone please help.
Aech
 
Posts: 11
Joined: Mon Mar 05, 2018 2:50 pm
Has thanked: 6 times
Been thanked: 0 time

Re: Reformat dynamic rows to columns

Postby prino » Wed Dec 01, 2021 10:12 pm

//REFORM EXEC PGM=THEFORCE,PARM='JEDI'
Robert AH Prins
robert.ah.prins @ the.17+Gb.Google thingy
User avatar
prino
 
Posts: 641
Joined: Wed Mar 11, 2009 12:22 am
Location: Vilnius, Lithuania
Has thanked: 3 times
Been thanked: 29 times

Re: Reformat dynamic rows to columns

Postby enrico-sorichetti » Wed Dec 01, 2021 11:18 pm

Programming Announcement

New Operating System (5781-WOW)

Due to the fact that so many users have asked for an operating system of
even greater capability than zVM, and zOS BM announces the Virtual Universe Operating System - zOS/VU.

Running under zOS/VU, the individual user appears to have not merely
a machine of his own, but an entire universe of his own,
in which he can set up and take down his own programs,
data sets, system networks, personnel, and planetary systems.

He need only specify the universe he desires,
and the zOS/VU system generation program (IEHGOD) does the rest.
This program will reside in SYS1.GODLIB.

The minimum time for this function is 6 days of activity and 1 day of rest and review.
In conjunction with zOS/VU, all system utilities have been replaced by one program (IEHPROPHET)
which will reside in SYS1.MESSIAH.
This program has no parms or control cards as it knows what you want to do when it is executed.

Naturally, the user must have attained a certain degree of sophistication in the
data processing field if an efficient utilization of zOS/VU is to be achieved.

Frequent calls to non-resident galaxies, for instance,
can lead to unexpected delays in the execution of a job.

Although IBM, through its wholly-owned subsidiary, The United States,
is working on a program to upgrade the speed of light and thus reduce
the overhead of extraterrestrial and metadimensional paging,
users must be careful for the present to stay within the laws of physics.
IBM must charge an additional fee for violations.

zOS/VU will run on any IBM x0xx equipped with Extended WARP Feature.

Users should be aware that IBM plans to migrate all existing systems and hardware to zOS/VU
as soon as our engineers effect one output that is (conceptually) error-free.

This will give us a base to develop an even more powerful operation system,
target date 2051, designated " Virtual Reality".
zOS/VR is planned to enable the user to migrate to totally unreal universes.
To aid the user in identifying the difference between "Virtual Reality" and "Real Reality",
a file containing a linear arrangement of multisensory total records
of successive moments of now will be established. It's name will be SYS1.est.

For more information, contact your IBM Data Processing Representative.
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 3006
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 165 times

Re: Reformat dynamic rows to columns

Postby willy jensen » Thu Dec 02, 2021 1:07 am

What really is said above :-) is that this cannot be solved by JCL, certainly not by a JCL option, you need to use / write a program. Personally I am not aware of any standard programs capable of doing this, but I'm sure someone will correct me.
willy jensen
 
Posts: 467
Joined: Thu Mar 10, 2016 5:03 pm
Has thanked: 0 time
Been thanked: 70 times

Re: Reformat dynamic rows to columns

Postby Aech » Fri Dec 03, 2021 8:04 pm

Hi,

I think SPLICE is the answer, saw something similar in the Experts forum - https://ibmmainframes.com/about23725.html by Frank. Bit of studying and alot of trail and error but here it is if anyone needs it

//*                                                                    
//JSTEP001 EXEC PGM=ICETOOL                                            
//DFSMSG   DD   SYSOUT=*                                              
//TOOLMSG  DD   SYSOUT=*                                              
//IN       DD   *                                                      
Job1    Description1    Monday                                        
Job2    Description2    Friday                                        
Job3    Description3    Monday                                        
                        Thursday                                      
Job4    Description4    Monday                                        
Job4    Description4    Tuesday                                        
                        Wednesday                                      
                        Thursday                                      
                        Friday                                        
Job5    Description5    Sunday                                        
/*                                                                    
//T1       DD   DSN=&&T1,DISP=(NEW,CATLG,DELETE),SPACE=(CYL,(1,1),RLSE)
//OUT      DD   SYSOUT=*                                              
//TOOLIN   DD   *                                                      
 COPY FROM(IN) TO(T1) USING(CTL1)                                
 SPLICE FROM(T1) TO(OUT) ON(1,20,CH) WITHANY KEEPNODUPS -        
   WITH(25,10) WITH(35,10) WITH(45,10) WITH(55,10) WITH(65,10)    
/*                                                                
//CTL1CNTL DD   *                                                
 INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,2,CH,EQ,C'Job'),              
 PUSH=(80:1,20))                                                  
 OUTREC IFOUTLEN=80,                                              
 IFTHEN=(WHEN=INIT,OVERLAY=(101:SEQNUM,2,ZD,RESTART=(80,20))),    
 IFTHEN=(WHEN=(101,2,ZD,EQ,1),BUILD=(80,20,25:25,10)),            
 IFTHEN=(WHEN=(101,2,ZD,EQ,2),BUILD=(80,20,35:25,10)),            
 IFTHEN=(WHEN=(101,2,ZD,EQ,3),BUILD=(80,20,45:25,10)),            
 IFTHEN=(WHEN=(101,2,ZD,EQ,4),BUILD=(80,20,55:25,10)),            
 IFTHEN=(WHEN=(101,2,ZD,EQ,5),BUILD=(80,20,65:25,10))            
/*                                                                



Output Below:

Job1    Description1    Monday                                        
Job2    Description2    Friday                                        
Job3    Description3    Monday    Thursday                            
Job4    Description4    Monday    Tuesday   Wednesday Thursday  Friday
Job5    Description5    Sunday                                        
Aech
 
Posts: 11
Joined: Mon Mar 05, 2018 2:50 pm
Has thanked: 6 times
Been thanked: 0 time

Re: Reformat dynamic rows to columns

Postby willy jensen » Fri Dec 03, 2021 8:16 pm

well done ;)
willy jensen
 
Posts: 467
Joined: Thu Mar 10, 2016 5:03 pm
Has thanked: 0 time
Been thanked: 70 times


Return to JCL

 


  • Related topics
    Replies
    Views
    Last post