=COLS> ----+----1----+----2----+----3----+-----4----+----5----+----6----+----7----+-
****** ***************************** Top of Data************************************
000001 0 MONTHEND TAPE ZAPS
000002 PROD FILE NAME BACKUP FILE NAME
000003 0 PDSCU.CFXMA.A.FILE1 PDSCU.CFX.F.FILE2
000004 0 PDSCU.CFX.B.FILE1 PDSCU.CFX.G.FILE2
000005 0 E N D O F R E P O R T
Special consideration here is that
1. 0 is getting padded in the first column.
2. we have the header 'MONTHEND TAPE ZAPS'
3. we have the trailer 'E N D O F R E P O R T'
4. when the input1 records are copied to output then we have a heading of PROD FILE NAME on top of the records copied from file1.
5. 4. when the input2 records are copied to output then the have a heading of BACKUP FILE NAME on top of the records copied from input2.
6. The lesser of the records in the file are used and only that many records are picked up from the other input file and copied over to the output file. e.g. there are 5 records in input file1 & 2 records in the input file2 then only 2 records are picked from each file and written to the output file & vice versa.
earlier i posted this because i thought that this could be done with PGM=SORT, but that could not be done....so thats why i posted this with the same subject in the COBOL forum but then you told me i cant post this with the same SUBJECT line so i posted this the 3rd time with a different subject.
I dont want the whole program written for this. I just want to know the logic that would go into this as i am not able to think about it. I have thought a lot by couldnt come up with a solution.
I wanted to know how can we accomplish this as the data is written one record(in this case 133 columns) at a time so how is it going to be accomplised as from the first file we need to write the records & then in the same line we need to write records from another file.
Please help.
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
Hello,
Quote:
i thought that this could be done with PGM=SORT, but that could not be done....
Only partly true - this can be done with ICETOOL - which is part of the DFSORT product your organization is using.
Suggest you tell your management that you have a solution that is already tested and working but you need either permission to use it or a change in the "rules" so that you do not need an exception to the rules.
You might also point "them" at Frank's repeated mention that ICETOOL has been delivered with DFSORT and has been fully supported for over 15 years.
To get the output you want, you would need to write in cobol all of the code needed to do what Frank did with his few control statements.
I suggest you get some manager to sign off on this:
Quote:
The lesser of the records in the file are used and only that many records are picked up from the other input file and copied over to the output file.
as it makes no sense to arbitrarily throw away some of the records. What good is the sample output if it does not reflect the true situation?
The logic to do what you want (as shown) is to have 2 input FDs, one output FD and some definitions for headings. To create the report read a record from each file and move it to the left or right output file name area. Write the line and read them again. When either file reaches eof, terminate the run.
As i said, no where i have been would request or accept such a report, so i'd encourage you to make sure of the requirement definition.
I've deleted the "locked" topic and the topic in the DFSORT part of the forum is there if you are able to use that.
Actually i had talked to my manager about the use of ICETOOL, but he didnt approve of it saying that it incurrs an extra cost every time we use it and told us to stick to PGM=SORT.
The thing you mentioned about the records being lost, i sure had given it a thought earlier & will clarify with my manager about the gaps.
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
You're welcome
Quote:
he didnt approve of it saying that it incurrs an extra cost every time we use it
What extra cost does this incur? Is the issue that there is another like of usage with the additional executable? That sholdn't be viewed separately, but rather as part of the resources to run sort applicatiins.
If there are concerns or questions by your manager, i would willing to try to explain about what is already available to you. If it got too detailed for me, i'd involve Frank who has written much of the product.
Good luck and someone will be here if there is something that needs clarification
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
Whoops. . .
Quote:
To further add on our call to SORT invokes
"SYNCSORT FOR Z/OS 1.2.3.1R1"
Your system is running Syncsort rather than DFSORT. While you may not be permitted to use the icetool solution, it might be handy to know whether it would work in your environment.
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
vikramyadav,
Given that you have SyncSort, you'd be able to do this using PGM=SORT and a SYNCSORT 'JOIN'. You could have avoided this unnecessary wastage of time(both yours and those who spent time on this), if you had mentioned this in your initial post. Syncsort questions are discussed in JCL forum and not in DFSORT forum. Keep this in mind for your future posts.
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
vikramyadav wrote:
The manager says he wants the output as is there in the post i mentioned. He is not concerned about the data loss
vikramyadav,
Was that the reply you got from a Manager.
I dont have access to mainframe now. But I can show you a possible way of achieving the same using SyncSort. Try that and post back the SYSOUT if you come across any errors.
The manager is further investigating about the essential data being thrown away. He said he will get back on this to me soon. He wants to check on the impact of the data that is thrown away.
However in this time i tested the above code and the output is as follows.
Code:
=COLS> ----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
****** ***************************** Top of Data ******************************
000001 10 MONTHEND TAPE ZAPS
000002 PROD FILE NAME BACKUP FILE N
000003 10 PDSCU.CFXMA.A.FILE1 PDSCU.CFX.F.F
000004 0 PDSCU.CFX.B.FILE1 PDSCU.CFX.G.F
000005 10 E N D O F R E P O R T
As can been seen that we are getting 1 in 1st column and the zero has shifted to the second column, because of which i had to make 132 in place of 133 else i was getting an error.
when i browse the file then the output is as expected as follows
Code:
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
********************************* Top of Data **********************************
0 MONTHEND TAPE ZAPS
PROD FILE NAME BACKUP FILE NAME
0 PDSCU.CFXMA.A.FILE1 PDSCU.CFX.F.FILE2
0 PDSCU.CFX.B.FILE1 PDSCU.CFX.G.FILE2
0 E N D O F R E P O R T
But yes i did make a change in the code from 133 to 132 as follows
Code:
INREC FIELDS=(C'0',12:1,44,59:45,44,133:X)
SORT FIELDS=COPY
OUTFIL HEADER1=(C'0',40:C'MONTHEND TAPE ZAPS',132:X,/,
12:C'PROD FILE NAME',59:C'BACKUP FILE NAME'),
TRAILER1=(C'0',44:C'E N D O F R E P O R T',132:X)
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
vikramyadav,
Add the REMOVECC parameter to the 3rd step SYSIN of my previous JCL like this and make sure you're NOT changing any other parameters. Your output file will be FBA/133 as mentioned in your initial post.
Code:
//SYSIN DD *
JOINKEYS FILE=F1,FIELDS=(46,8,A)
JOINKEYS FILE=F2,FIELDS=(46,8,A)
REFORMAT FIELDS=(F1:1,44,F2:1,44)
INREC FIELDS=(C'0',12:1,44,59:45,44,133:X)
SORT FIELDS=COPY
OUTFIL REMOVECC,
HEADER1=(C'0',40:C'MONTHEND TAPE ZAPS',133:X,/,
12:C'PROD FILE NAME',59:C'BACKUP FILE NAME'),
TRAILER1=(C'0',44:C'E N D O F R E P O R T',133:X)
It worked good now. My manager has replied on the data being lost due to unequal number of datasets in both the input files. He just says that-". I would recommend that the program issue a message and a Return Code that is not zero if one file has more records than the other." This is just the addition that is required here.
We will need to calculate the number of records in each file and if they are unequal then we need to return a return code which is 200.Please let me know how this can be accomplished. Thanks
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
Quote:
We will need to calculate the number of records in each file and if they are unequal then we need to return a return code which is 200
vikramyadav,
I have modified step-3 to return '4' if you have an unbalanced input. For a balanced input, RC would be '0'. I don't believe you'll be able to force an RC=200 from SyncSort.
Code:
//STEP3 EXEC PGM=SYNCTOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//CTL1JNF1 DD DSN=&&TEMP1,DISP=(OLD,PASS)
//CTL1JNF2 DD DSN=&&TEMP2,DISP=(OLD,PASS)
//ERROR DD DSN=&&TEMP3,DISP=(,PASS)
//OUT DD DSN= Output file FBA/LRECL=133
//TOOLIN DD *
COPY FROM(CTL1JNF1) USING(CTL1)
COUNT FROM(ERROR) RC4 NOTEMPTY
//CTL1CNTL DD *
JOINKEYS FILE=F1,FIELDS=(46,8,A)
JOINKEYS FILE=F2,FIELDS=(46,8,A)
JOIN UNPAIRED,F1,F2
REFORMAT FIELDS=(F1:1,44,F2:1,44)
INREC FIELDS=(C'0',12:1,44,59:45,44,133:X)
SORT FIELDS=COPY
OUTFIL FNAMES=OUT,REMOVECC,
INCLUDE=(12,1,CH,NE,C' ',AND,59,1,CH,NE,C' '),
HEADER1=(C'0',40:C'MONTHEND TAPE ZAPS',133:X,/,
12:C'PROD FILE NAME',59:C'BACKUP FILE NAME'),
TRAILER1=(C'0',44:C'E N D O F R E P O R T',133:X)
OUTFIL FNAMES=ERROR,SAVE