Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Creating a file from multiple file
Goto page 1, 2  Next
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
Shriram Jogdand

New User


Joined: 14 Oct 2008
Posts: 65
Location: Pune

PostPosted: Thu Aug 04, 2011 1:01 pm    Post subject: Creating a file from multiple file
Reply with quote

Hi,

I have 4 files with length 9. Each file have 2 records with first record as table name and second record as count of records.
e.g

File-1
EMPLOYEE
000000110

File-2
DEPT
000250154

File-3
SALARY
102489501

File-4
TECH
555555555


Now I wanted to created a file (report) which will have merge of all this file and should look like

EMPLOYEE;DEPT;SALARY;TECH
000000110;000250154;102489501;555555555


Can we do this through a job without using cobol program?
Back to top
View user's profile Send private message

gylbharat

Active Member


Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

PostPosted: Thu Aug 04, 2011 1:13 pm    Post subject:
Reply with quote

Can you some some more examples...

Is it 1-1 mapping? all the files have same number of records??
Back to top
View user's profile Send private message
Shriram Jogdand

New User


Joined: 14 Oct 2008
Posts: 65
Location: Pune

PostPosted: Thu Aug 04, 2011 1:18 pm    Post subject: Reply to: Creating a file from multiple file
Reply with quote

Yes, All files have 2 records only and are exactly the same as I have explained in the example. The only difference with actual one is the table names which I have given for understanding. Rest everything is same.
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1445
Location: Azeroth

PostPosted: Thu Aug 04, 2011 1:43 pm    Post subject:
Reply with quote

Hello,
Does all the 4 files have the same LRECL and whether they are FB or VB?

What SORT product do you have?

Will the length of the fields, i.e. length of the data remain the same?
Code:
EMPLOYEE
000000110 <- Will this length be same?
Back to top
View user's profile Send private message
Shriram Jogdand

New User


Joined: 14 Oct 2008
Posts: 65
Location: Pune

PostPosted: Thu Aug 04, 2011 2:24 pm    Post subject: Reply to: Creating a file from multiple file
Reply with quote

Yes, the length of all files is same and have only 2 records. All are FB files. We use DFSORT.
Back to top
View user's profile Send private message
gylbharat

Active Member


Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

PostPosted: Thu Aug 04, 2011 2:46 pm    Post subject: Re: Reply to: Creating a file from multiple file
Reply with quote

Shriram Jogdand wrote:
have only 2 records.


What does this mean? only two records are there in all the 4 files? and is it a one time activity?
Back to top
View user's profile Send private message
Shriram Jogdand

New User


Joined: 14 Oct 2008
Posts: 65
Location: Pune

PostPosted: Thu Aug 04, 2011 2:52 pm    Post subject: Reply to: Creating a file from multiple file
Reply with quote

Its not a one time activity. we have to prepare som kind of report. Each input file have 2 records. First record with Table name and second with no. of records present in that table.
Back to top
View user's profile Send private message
gylbharat

Active Member


Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

PostPosted: Thu Aug 04, 2011 4:34 pm    Post subject:
Reply with quote

Here you go...
Code:

//STEP1 EXEC PGM=ICETOOL                                               
//TOOLMSG DD SYSOUT=*                                                   
//DFSMSG  DD SYSOUT=*                                                   
//IN      DD *                                                         
EMPLOYEE                                                               
000000110                                                               
DEPT                                                                   
000250154                                                               
SALARY                                                                 
102489501                                                               
TECH                                                                   
555555555                                                               
/*                                                                     
//OUT     DD SYSOUT=*                                                   
//TOOLIN  DD *                                                         
  SPLICE FROM(IN) TO(OUT) ON(91,1,ZD) KEEPNODUPS WITHEACH -             
  WITH(12,11) WITH(23,11) WITH(34,11) WITH(45,11) WITH(56,11) -         
  WITH(67,11) WITH(78,11) USING(CTL1)                                   
/*                                                                     
//CTL1CNTL DD *                                                         
  INREC IFTHEN=(WHEN=GROUP,RECORDS=8,PUSH=(91:ID=1,SEQ=1)),             
        IFTHEN=(WHEN=(92,1,ZD,EQ,1),OVERLAY=(01:1,10,11:C';')),         
        IFTHEN=(WHEN=(92,1,ZD,EQ,2),OVERLAY=(12:1,10,22:C';')),         
        IFTHEN=(WHEN=(92,1,ZD,EQ,3),OVERLAY=(23:1,10,33:C';')),         
        IFTHEN=(WHEN=(92,1,ZD,EQ,4),OVERLAY=(34:1,10,44:C';')),         
        IFTHEN=(WHEN=(92,1,ZD,EQ,5),OVERLAY=(45:1,10,55:C';')),         
        IFTHEN=(WHEN=(92,1,ZD,EQ,6),OVERLAY=(56:1,10,66:C';')),         
        IFTHEN=(WHEN=(92,1,ZD,EQ,7),OVERLAY=(67:1,10,77:C';')),         
        IFTHEN=(WHEN=(92,1,ZD,EQ,8),OVERLAY=(78:1,10,88:C';'))         
  SORT FIELDS=COPY                                                     
  OUTFIL BUILD=(1,90)                                                   
/*                                                                     
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1445
Location: Azeroth

PostPosted: Thu Aug 04, 2011 4:42 pm    Post subject:
Reply with quote

GylBharat,
Did you test your code?
The output is on a single line for me icon_confused.gif
Back to top
View user's profile Send private message
gylbharat

Active Member


Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

PostPosted: Thu Aug 04, 2011 4:50 pm    Post subject:
Reply with quote

oh sorry... My mistake... I thought TS wants all on one line.
Back to top
View user's profile Send private message
Shriram Jogdand

New User


Joined: 14 Oct 2008
Posts: 65
Location: Pune

PostPosted: Thu Aug 04, 2011 5:05 pm    Post subject: Reply to: Creating a file from multiple file
Reply with quote

Output in one line is also not problem.

I have another question related to this. I have four files (LREC=9,FB) with one record each.

File-1
EMPLOYEE
File-2
DEPT
File-3
SALARY
File-4
TECH

Now I want output as

EMPLOYEE;DEPT;SALARY;TECH

How can we do it through sort?
Back to top
View user's profile Send private message
gylbharat

Active Member


Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

PostPosted: Thu Aug 04, 2011 5:09 pm    Post subject:
Reply with quote

Will this work for you?

Merge all the four files in the SORTIN
Code:

//STEP010 EXEC PGM=SORT                                                 
//SYSOUT  DD SYSOUT=*                                                   
//SORTIN  DD DSN=FILE01,DIPS=SHR                   
//             DD DSN=FILE02,DIPS=SHR
//             DD DSN=FILE03,DIPS=SHR
//             DD DSN=FILE04,DIPS=SHR
//SORTOUT DD SYSOUT=*                                                   
//SYSIN   DD *                                                         
  INREC IFTHEN=(WHEN=GROUP,RECORDS=2,PUSH=(81:SEQ=1,1,15))             
  SORT FIELDS=COPY                                                     
  OUTFIL INCLUDE=(81,1,ZD,EQ,2),BUILD=(82,15,1,15)                     
/*                               



Code:

//STEP010 EXEC PGM=SORT                                                 
//SYSOUT  DD SYSOUT=*                                                   
//SORTIN  DD *                                                         
EMPLOYEE                                                               
000000110                                                               
DEPT                                                                   
000250154                                                               
SALARY                                                                 
102489501                                                               
TECH                                                                   
555555555                                                               
/*                                                                     
//SORTOUT DD SYSOUT=*                                                   
//SYSIN   DD *                                                         
  INREC IFTHEN=(WHEN=GROUP,RECORDS=2,PUSH=(81:SEQ=1,1,15))             
  SORT FIELDS=COPY                                                     
  OUTFIL INCLUDE=(81,1,ZD,EQ,2),BUILD=(82,15,1,15)                     
/*                                                                     


Output
Code:

 BROWSE - SORTOUT           STEP010  - Page  1     Line  1      Cols 1-80       
 COMMAND ===>                                                SCROLL ===> CURSOR
******************************** Top of Data ***********************************
EMPLOYEE       000000110                                                       
DEPT           000250154                                                       
SALARY         102489501                                                       
TECH           555555555                                                       
 ******************************* Bottom of Data ********************************

[/code]
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1445
Location: Azeroth

PostPosted: Thu Aug 04, 2011 5:24 pm    Post subject:
Reply with quote

Apologies If my question
Quote:
"What SORT product you have"

made Kevin to shift this topic from JCL to DFSORT icon_redface.gif . I guess requirement could be achieved by few lines of REXX, but I may have misdirected this thread towards a DFSORT solution(which is comparitively complex compared to REXX).
Back to top
View user's profile Send private message
Shriram Jogdand

New User


Joined: 14 Oct 2008
Posts: 65
Location: Pune

PostPosted: Thu Aug 04, 2011 5:26 pm    Post subject: Reply to: Creating a file from multiple file
Reply with quote

The main problem is that I want table names on one line and their counts on second line.

Now consider that each file have one record as table name. then I want output as

EMPLOYEE;DEPT;SALARY;TECH

any help?
Back to top
View user's profile Send private message
Shriram Jogdand

New User


Joined: 14 Oct 2008
Posts: 65
Location: Pune

PostPosted: Thu Aug 04, 2011 5:45 pm    Post subject: Reply to: Creating a file from multiple file
Reply with quote

You can consider another case. I have ONE file with 4 records(Records are EMPLOYEE, DEPT, SALER, TECH). I wanted to create a single record out of it as

EMPLOYEE DEPT SALARY TECH

nOW ANY SUGGESTIONS?
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Thu Aug 04, 2011 7:39 pm    Post subject:
Reply with quote

Hi,
Check if this solves your requirement..
Code:

//S1    EXEC  PGM=ICETOOL                                           
//SYSOUT    DD  SYSOUT=*                                             
//DFSMSG    DD  SYSOUT=*                                             
//TOOLMSG   DD  SYSOUT=*                                             
//IN9 DD DSN=file1,DISP=SHR                             
//   DD DSN=file2,DISP=SHR                             
//   DD DSN=file3,DISP=SHR                             
//   DD DSN=file4,DISP=SHR                             
//OUT DD SYSOUT=*                                                   
//TOOLIN DD *                                                       
  RESIZE FROM(IN9) TO(OUT) TOLEN(40) USING(CTL1)                     
//CTL1CNTL DD *                                                     
 SORT FIELDS=(10,1,CH,A)                                             
 INREC  IFTHEN=(WHEN=GROUP,RECORDS=2,PUSH=(10:SEQ=1))               
 OUTFIL IFTHEN=(WHEN=INIT,OVERLAY=(10:C';',20:C';',30:C';',40:C' ')),
        IFTHEN=(WHEN=INIT,OVERLAY=(1,40,SQZ=(SHIFT=LEFT)))           

Output will be
Code:

EMPLOYEE;DEPT;SALARY;TECH             
000000110;000250154;102489501;555555555
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Thu Aug 04, 2011 11:18 pm    Post subject:
Reply with quote

vasanthz wrote:
I guess requirement could be achieved by few lines of REXX, but I may have misdirected this thread towards a DFSORT solution(which is comparitively complex compared to REXX).


vasanthz,

Are you saying that Escapa's solution with RESIZE (5 lines of control cards) is much complex than a few lines of REXX? Wow

Most shops don't let you use REXX in batch mode.
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1445
Location: Azeroth

PostPosted: Fri Aug 05, 2011 12:16 pm    Post subject:
Reply with quote

Will all respect to Kolusu. I still believe REXX is simpler,
If the input file is read into stem variable STM. then,
Code:
OUTSTEM.1 = STRIP(STM.1)||';'||STRIP(STM.3)||';'||STRIP(STM.5)||';',   
            ||STRIP(STM.7)                                             
OUTSTEM.2 = STRIP(STM.2)||';'||STRIP(STM.4)||';'||STRIP(STM.6)||';',   
            ||STRIP(STM.6)
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1445
Location: Azeroth

PostPosted: Fri Aug 05, 2011 12:32 pm    Post subject:
Reply with quote

Also, REXX would work if the output dataset LRECL needs to be 80 which is same as Input dataset,
I am not an expert in DFSORT, but I think that the above job would fail if,
the output dataset also needs to be LRECL 80 which is same as input.

Quote:
Most shops don't let you use REXX in batch mode.

I don't know about others but my shop with more than 100 LPARS have let me use them.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Fri Aug 05, 2011 11:01 pm    Post subject:
Reply with quote

Quote:
I am not an expert in DFSORT, but I think that the above job would fail if, the output dataset also needs to be LRECL 80 which is same as input.


The DFSORT job could easily be changed to handle that. Just add IFOUTLEN=80 to the OUTFIL statement.

"Simpler" is obviously in the eyes of the beholder. icon_wink.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 -> DFSORT/ICETOOL All times are GMT + 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts CICS Roll back partially - Need to re... dwijadas CICS 4 Wed Nov 16, 2016 4:30 pm
No new posts Problem in writing Output file vickey_dw COBOL Programming 5 Mon Nov 14, 2016 11:14 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us