View previous topic :: View next topic
Author
Message
Shriram Jogdand New User Joined: 14 Oct 2008Posts: 65 Location: Pune
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
gylbharat Active Member Joined: 31 Jul 2009Posts: 565 Location: Bangalore
Can you some some more examples...
Is it 1-1 mapping? all the files have same number of records??
Back to top
Shriram Jogdand New User Joined: 14 Oct 2008Posts: 65 Location: Pune
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
vasanthz Global Moderator Joined: 28 Aug 2007Posts: 1742 Location: Tirupur, India
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
Shriram Jogdand New User Joined: 14 Oct 2008Posts: 65 Location: Pune
Yes, the length of all files is same and have only 2 records. All are FB files. We use DFSORT.
Back to top
gylbharat Active Member Joined: 31 Jul 2009Posts: 565 Location: Bangalore
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
Shriram Jogdand New User Joined: 14 Oct 2008Posts: 65 Location: Pune
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
gylbharat Active Member Joined: 31 Jul 2009Posts: 565 Location: Bangalore
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
vasanthz Global Moderator Joined: 28 Aug 2007Posts: 1742 Location: Tirupur, India
GylBharat,
Did you test your code?
The output is on a single line for me
Back to top
gylbharat Active Member Joined: 31 Jul 2009Posts: 565 Location: Bangalore
oh sorry... My mistake... I thought TS wants all on one line.
Back to top
Shriram Jogdand New User Joined: 14 Oct 2008Posts: 65 Location: Pune
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
gylbharat Active Member Joined: 31 Jul 2009Posts: 565 Location: Bangalore
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
vasanthz Global Moderator Joined: 28 Aug 2007Posts: 1742 Location: Tirupur, India
Apologies If my question
Quote:
"What SORT product you have"
made Kevin to shift this topic from JCL to DFSORT . 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
Shriram Jogdand New User Joined: 14 Oct 2008Posts: 65 Location: Pune
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
Shriram Jogdand New User Joined: 14 Oct 2008Posts: 65 Location: Pune
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
Escapa Senior Member Joined: 16 Feb 2007Posts: 1399 Location: IL, USA
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
Skolusu Senior Member Joined: 07 Dec 2007Posts: 2205 Location: San Jose
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
vasanthz Global Moderator Joined: 28 Aug 2007Posts: 1742 Location: Tirupur, India
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
vasanthz Global Moderator Joined: 28 Aug 2007Posts: 1742 Location: Tirupur, India
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
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
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.
Back to top
Skolusu Senior Member Joined: 07 Dec 2007Posts: 2205 Location: San Jose
Frank Yaeger wrote:
Just add IFOUTLEN=80 to the OUTFIL statement.
"Simpler" is obviously in the eyes of the beholder.
or a simple 80:X on one of the OUTFIL IFTHEN statements at the end
Back to top
vasanthz Global Moderator Joined: 28 Aug 2007Posts: 1742 Location: Tirupur, India
Quote:
"Simpler" is obviously in the eyes of the beholder.
Agreed (:
Back to top
Please enable JavaScript!