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
 

 

Need output with headers & footer & in the required

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
vikramyadav

New User


Joined: 28 May 2005
Posts: 41
Location: Gurgaon

PostPosted: Sat Dec 13, 2008 8:41 am    Post subject: Need output with headers & footer & in the required
Reply with quote

Hi All,

I have 2 input files with with LRECL=45, FB
i want the output in the oufile file with LRECL=133, FBA

I have the below requirement:

Input File 1
Code:

=COLS> ----+----1----+----2
****** ********************
000001 PDSCU.CFXMA.A.FILE1
000002 PDSCU.CFX.B.FILE1   
000003 PDSCU.CFXMA.C.FILE1
000004 PDSCU.CFXMA.D.FILE1
000005 PDSCU.CFX.E.FILE1


Input File 2
Code:

=COLS> ----+----1----+--
****** *****************
000001 PDSCU.CFX.F.FILE2
000002 PDSCU.CFX.G.FILE2


Output File
Code:

=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.
Back to top
View user's profile Send private message

dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Sat Dec 13, 2008 8:54 am    Post subject:
Reply with quote

How many times do you intend to post this same basic question? I believe this at least 3. . . icon_sad.gif

You need to write code to accomplish your requirement - we are not going to write it for you.

We will help when you have problems.
Back to top
View user's profile Send private message
vikramyadav

New User


Joined: 28 May 2005
Posts: 41
Location: Gurgaon

PostPosted: Sat Dec 13, 2008 9:46 am    Post subject: Hi Dick
Reply with quote

Hi Dick,

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.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Sat Dec 13, 2008 10:09 am    Post subject:
Reply with quote

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.
Back to top
View user's profile Send private message
vikramyadav

New User


Joined: 28 May 2005
Posts: 41
Location: Gurgaon

PostPosted: Sat Dec 13, 2008 10:52 am    Post subject: Hi Dick
Reply with quote

Thanks a lot Dick,

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.

Thanks again
Back to top
View user's profile Send private message
vikramyadav

New User


Joined: 28 May 2005
Posts: 41
Location: Gurgaon

PostPosted: Sat Dec 13, 2008 10:59 am    Post subject: Hi DIck
Reply with quote

To further add on our call to SORT invokes
"SYNCSORT FOR Z/OS 1.2.3.1R1"
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Sat Dec 13, 2008 11:00 am    Post subject:
Reply with quote

You're welcome icon_smile.gif

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 icon_smile.gif
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Sat Dec 13, 2008 11:06 am    Post subject:
Reply with quote

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.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2158
Location: @my desk

PostPosted: Sat Dec 13, 2008 11:54 am    Post subject:
Reply with quote

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.
Back to top
View user's profile Send private message
vikramyadav

New User


Joined: 28 May 2005
Posts: 41
Location: Gurgaon

PostPosted: Sat Dec 13, 2008 12:31 pm    Post subject:
Reply with quote

Hey thanks Arun.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2158
Location: @my desk

PostPosted: Sat Dec 13, 2008 12:35 pm    Post subject:
Reply with quote

You're welcome. But before going into that can you explain in a few words what exactly is this whole requirement about.
Quote:
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.
Did you find something from your manager?
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2158
Location: @my desk

PostPosted: Sat Dec 13, 2008 4:02 pm    Post subject:
Reply with quote

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.icon_eek.gif

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.
Code:
//STEP1     EXEC PGM=SORT                                             
//SYSOUT    DD SYSOUT=*                                               
//SORTIN    DD DSN= file1 ,FB/LRECL=45                                                       
//SORTOUT   DD DSN=&&TEMP1,DISP=(,PASS)                                               
//SYSIN     DD *                                                       
  OPTION COPY
  INREC OVERLAY=(46:SEQNUM,8,ZD)
//STEP2     EXEC PGM=SORT                                             
//SYSOUT    DD SYSOUT=*                                               
//SORTIN    DD DSN= file2 ,FB/LRECL=45                                                       
//SORTOUT   DD DSN=&&TEMP2,DISP=(,PASS)                                               
//SYSIN     DD *                                                       
  OPTION COPY
  INREC OVERLAY=(46:SEQNUM,8,ZD)                                                 
//STEP3     EXEC PGM=SORT                                             
//SYSOUT    DD SYSOUT=*                                               
//SORTJNF1  DD DSN=&&TEMP1,DISP=(OLD,PASS)                                               
//SORTJNF2  DD DSN=&&TEMP2,DISP=(OLD,PASS)
//SORTOUT   DD DSN= Output file ,FBA/LRECL=133   
//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 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)
Back to top
View user's profile Send private message
vikramyadav

New User


Joined: 28 May 2005
Posts: 41
Location: Gurgaon

PostPosted: Mon Dec 15, 2008 9:39 am    Post subject: Hi
Reply with quote

Hi,

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.
Back to top
View user's profile Send private message
vikramyadav

New User


Joined: 28 May 2005
Posts: 41
Location: Gurgaon

PostPosted: Mon Dec 15, 2008 9:44 am    Post subject: Hi
Reply with quote

Hey the above was in view mode,

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)
Back to top
View user's profile Send private message
vikramyadav

New User


Joined: 28 May 2005
Posts: 41
Location: Gurgaon

PostPosted: Mon Dec 15, 2008 9:58 am    Post subject: Considering the above 2 posts
Reply with quote

Hi,

Actually in view mode i should see only '0' instead of '10'

& in the browse mode i should not see anything inplace of '0'.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2158
Location: @my desk

PostPosted: Mon Dec 15, 2008 2:09 pm    Post subject:
Reply with quote

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)
Back to top
View user's profile Send private message
vikramyadav

New User


Joined: 28 May 2005
Posts: 41
Location: Gurgaon

PostPosted: Tue Dec 16, 2008 9:16 am    Post subject: hi
Reply with quote

Hi,

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
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2158
Location: @my desk

PostPosted: Tue Dec 16, 2008 9:37 pm    Post subject:
Reply with quote

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
Back to top
View user's profile Send private message
vikramyadav

New User


Joined: 28 May 2005
Posts: 41
Location: Gurgaon

PostPosted: Wed Dec 17, 2008 9:49 am    Post subject: Hi
Reply with quote

Hi Arun,

Thanks a lot this works fine. I am getting results as per the expectation. I tried testing with different scenerios and this works good. icon_biggrin.gif
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2158
Location: @my desk

PostPosted: Wed Dec 17, 2008 10:34 am    Post subject:
Reply with quote

vikramyadav,

You're welcome. Thanks for letting us know. icon_smile.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 -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Problem in writing Output file vickey_dw COBOL Programming 5 Mon Nov 14, 2016 11:14 pm
No new posts Syncsort - Hard coded Value in output PORYES SYNCSORT 1 Thu Nov 03, 2016 9:23 am
No new posts output data in CSV Format janmejay COBOL Programming 8 Sat Oct 15, 2016 2:20 pm
This topic is locked: you cannot edit posts or make replies. output data in CSV Format janmejay DFSORT/ICETOOL 3 Sat Oct 15, 2016 2:16 pm
No new posts ICETOOL/SYNCSORT - SYSPRINT output nartcr DFSORT/ICETOOL 17 Wed Oct 05, 2016 10:46 pm


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