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
 

 

Copy using SORT by including the trailer

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

New User


Joined: 02 Sep 2005
Posts: 39

PostPosted: Mon Apr 02, 2007 1:07 pm    Post subject: Copy using SORT by including the trailer
Reply with quote

Hi,

I need to copy a file to other.

My Input file looks like

File Header
Parameter(Assume value of this is X) Header
Parameter Record-1
Parameter Record-2
Parameter Record-3
99999 Followed by the current date and '3'[This is the record count for this parameter]
Parameter(Assume value of this is Y) Header
Parameter Record-1
Parameter Record-2
Parameter Record-3
Parameter Record-4
99999 Followed by the current date and '4'[This is the record count for this parameter]
Parameter(Assume value of this is Y) Header
Parameter Record-1
Parameter Record-2
99999 Followed by the current date and '2'[This is the record count for this parameter]
File Trailer


Output file when Parameter X is chosen should look like

File Header
Parameter(Assume value of this is X) Header
Parameter Record-1
Parameter Record-2
Parameter Record-3
99999 Followed by the current date and '3'[This is the record count for this parameter]
File Trailer


I was able to copy the file[File header, parameter header,parameter records and File trailer] using INCLUDE conditions. But the problem is coming with the parameter trailer[Here 99999]. Is it possible to include the trailer too in the output file?
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: Mon Apr 02, 2007 8:21 pm    Post subject:
Reply with quote

Please post the INCLUDE statement you used.

Please post an example of your actual input records and expected output records. (e.g. File Header does not tell us what the record actually looks like - show what the record actually looks like).

What is the RECFM and LRECL of the input file?
Back to top
View user's profile Send private message
itzphaniz

New User


Joined: 02 Sep 2005
Posts: 39

PostPosted: Tue Apr 03, 2007 9:49 am    Post subject:
Reply with quote

Code:
TTTTTTTFILEHDR                                       
TTTTTTTFILEDST20070315\XYZCMOA\CD1\XYZC03152007TTT
100101000XYZ  2007031511004110165510520000000001
100405000XYZ  2007031511004110165510520000000002
100505001XYZ  2007031511004110165510520000000003
100505010XYZ  2007031511004110165510520000000004
100506000XYZ  2007031511004110165510520000000005
100510000XYZ  2007031511004110165510520000000006
100512000XYZ  2007031511004110165510520000000007
100513000XYZ  2007031511004110165510520000000008
101005000XYZ  2007031511004110165510520000000009
101005000XYZ  2007031511004110165510520000000010
101005000XYZ  2007031511004110165510520000000011
999999                                                       20070315180000000000012
TTTTTTTFILEDST20070315\ZYXCMOA\CD1\ZYXC03152007TTT
100101000ZYX  2007031512013902602600535000000001             
100405000ZYX  2007031512013902602600535000000002             
100505001ZYX  2007031512013902602600535000000003             
100505010ZYX  2007031512013902602600535000000004             
100506000ZYX  2007031512013902602600535000000005             
100510000ZYX  2007031512013902602600535000000006             
100512000ZYX  2007031512013902602600535000000007             
100513000ZYX  2007031512013902602600535000000008             
101005000ZYX  2007031512013902602600535000000009             
101005000ZYX  2007031512013902602600535000000010             
101005000ZYX  2007031512013902602600535000000011             
101005000ZYX  2007031512013902602600535000000012             
102505000ZYX  2007031512013902602600535000000013             
100101000ZYX  2007031512013902622620536000000001
100405000ZYX  2007031512013902622620536000000002
100505001ZYX  2007031512013902622620536000000003
100505010ZYX  2007031512013902622620536000000004
100506000ZYX  2007031512013902622620536000000005
100510000ZYX  2007031512013902622620536000000006
100512000ZYX  2007031512013902622620536000000007
100513000ZYX  2007031512013902622620536000000008
999999                                                       2007031518000000000021
TTTTTTTFILETRL


Please note that:
TTTTTTTFILEHDR is the file header
TTTTTTTFILEDST is the parameter header
999999 is the parameter trailer
TTTTTTTFILETRL is the file trailer

When i give parameter as XYZ(column 24 to 3 bytes in parameter header) and MO(column 28 to 2 bytes in parameter header) and A(column 30 to 1 in parameter header) are given:

The output file should look like:
Code:
TTTTTTTFILEHDR                                       
TTTTTTTFILEDST20070315\XYZCMOA\CD1\XYZC03152007TTT
100101000XYZ  2007031511004110165510520000000001
100405000XYZ  2007031511004110165510520000000002
100505001XYZ  2007031511004110165510520000000003
100505010XYZ  2007031511004110165510520000000004
100506000XYZ  2007031511004110165510520000000005
100510000XYZ  2007031511004110165510520000000006
100512000XYZ  2007031511004110165510520000000007
100513000XYZ  2007031511004110165510520000000008
101005000XYZ  2007031511004110165510520000000009
101005000XYZ  2007031511004110165510520000000010
101005000XYZ  2007031511004110165510520000000011
999999                                                       20070315180000000000012
TTTTTTTFILETRL


Here are the include that i used:
Code:
OPTION COPY                                                         
INCLUDE COND=(1,14,CH,EQ,C'TTTTTTTFILEHDR',OR,                     
     1,14,CH,EQ,C'TTTTTTTFILEHDR',OR,                               
     10,3,CH,EQ,C'XYZ',OR,                                         
    (24,3,CH,EQ,C'XYZ',AND,28,2,CH,EQ,C'MO',AND,30,1,CH,EQ,C'A'),OR,
     1,6,CH,EQ,C'999999')                                           


For the current input i was getting 2 '999999' parameter trailer records in the output file where as i should be getting only one.
The RECFM is FB and lrecl is 458.
Please shoot if you have any more questions?
Back to top
View user's profile Send private message
itzphaniz

New User


Joined: 02 Sep 2005
Posts: 39

PostPosted: Tue Apr 03, 2007 10:03 am    Post subject:
Reply with quote

Please note that at any point, there can numerous parameter headers and trailers. I just gave an example of an input file which has just 2 parameter headers. And if you closely observe at the parameter records, the record number is specified at 46th column.
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: Tue Apr 03, 2007 8:37 pm    Post subject:
Reply with quote

I suspect there's more to this requirement than you're saying. Are you trying to pick a particular group of records, or particular groups of records, by specifying the parameter? For example, might you want to select the third group (e.g. QRS) and the fifth group (e.g. NMN)?

I would guess that you can use the technique shown in the "Include or omit groups of records" Smart DFSORT Trick at:

http://www.ibm.com/servers/storage/support/software/sort/mvs/tricks/
Back to top
View user's profile Send private message
itzphaniz

New User


Joined: 02 Sep 2005
Posts: 39

PostPosted: Wed Apr 04, 2007 9:07 am    Post subject:
Reply with quote

Frank-

There is nothing more to this requirement. I mean, in any instance we would like to fetch only one parameter.

Quote:
For example, might you want to select the third group (e.g. QRS) and the fifth group (e.g. NMN)?


This is not a part of our requirement. I hope i'm clear.
To sum it up, when a parameter is passed[Ex:QRS, let it be third group,MO and A], Output file should like:

Code:
TTTTFile header
QRS Parameter Header
QRS Parameter records
9999    Trailer with number of parameter records
TTTTFile Trailer


Please help me out.
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Wed Apr 04, 2007 5:33 pm    Post subject: Hope this works
Reply with quote

itzphaniz

The main prob where u r facing is the trailer(9999) record.

So What i could suggest is have an intermediate step to get the records that satisfy the parameter condition and write it in to one file.
Step1. So if this is the I/P
Code:

TTTTFile header
QRS Parameter Header
QRS Parameter records
9999    Trailer with number of parameter records
TTTTFile Trailer

after the selecting only the QRS records, O/P should cintain
Code:

QRS Parameter Header
QRS Parameter records

Step2. Now u take this O/P and count the no. of records and punch the record trailer(99999 followed by date and count)
Step3. Add the FIle header and trailer

I regret if second step is not possible!
Back to top
View user's profile Send private message
itzphaniz

New User


Joined: 02 Sep 2005
Posts: 39

PostPosted: Wed Apr 04, 2007 6:42 pm    Post subject:
Reply with quote

krisprems-

Even i thought of similar way of handling. But the problem is apart from 99999 and date and count, there is another parameter which is varying.

For example:

If u look at my input file for

Code:
999999                                                       20070315180000000000012

is 180. This keeps varying. So i had to rule this option out. Ne more suggestions please?
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: Thu Apr 05, 2007 4:52 am    Post subject:
Reply with quote

You can use the technique shown in the "Include or omit groups of records" Smart DFSORT Trick at:

http://www.ibm.com/servers/storage/support/software/sort/mvs/tricks/
Back to top
View user's profile Send private message
itzphaniz

New User


Joined: 02 Sep 2005
Posts: 39

PostPosted: Thu Apr 05, 2007 11:15 am    Post subject:
Reply with quote

Frank:

I got the following error when i used EXEC PGM=ICETOOL,

Code:
ACC20210-E ADDVOL FOR DD=T1 DSN=SYS07095.T001106.RA000.DP8961FC.T1.H05
ACC20625-E DCB IS USING EXCP                                           
IEC030I B37-04,IFG0554A,DP8961FC,DUMMYSRT,T1,5008,PAH008,SYS07095.T0011
IEA995I SYMPTOM DUMP OUTPUT                                           
SYSTEM COMPLETION CODE=B37  REASON CODE=00000004                       
 TIME=00.11.13  SEQ=15895  CPU=0000  ASID=0349                         
 PSW AT TIME OF ERROR  075C1000   80E31CDE  ILC 2  INTC 0D             
   NO ACTIVE MODULE FOUND   


I was unable to figure out the error. The job abended with SB37.
Back to top
View user's profile Send private message
ashwinreddy

Active User


Joined: 16 Sep 2004
Posts: 106
Location: Hyderabad

PostPosted: Thu Apr 05, 2007 12:23 pm    Post subject:
Reply with quote

OPTION COPY
INCLUDE COND=(1,14,CH,EQ,C'TTTTTTTFILEHDR',OR,
1,14,CH,EQ,C'TTTTTTTFILEHDR',OR,
10,3,CH,EQ,C'XYZ',OR,
(24,3,CH,EQ,C'XYZ',AND,28,2,CH,EQ,C'MO',AND,30,1,CH,EQ,C'A'),OR,
1,6,CH,EQ,C'999999')

In the above include condition why have you repeated the header condition twice.


Is that your requirement or typo mistake.

Cheers
Ashwin
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Thu Apr 05, 2007 12:30 pm    Post subject:
Reply with quote

I found this in about 30 seconds by clicking on the "Manuals" link at the top of the page, and then looking at the MVS SYSTEMS CODES book.

I found this in under 30 second by clicking the manuals link at the top of the page and then looking at the MVS SYSTEMS CODES book.

B37

Explanation: The error was detected by the end-of-volume routine.
This system completion code is accompanied by message IEC030I. Refer
to the explanation of message IEC030I for complete information about
the task that was ended and for an explanation of the return code (rc
in the message text) in register 15.

Source: DFSMSdfp

Application Programmer Response: Respond as indicated for message
IEC030I.

System Programmer Response: If the error recurs and the program is
not in error, look at the messages in the job log for more
information. Search problem reporting data bases for a fix for the
problem. If no fix exists, contact the IBM Support Center. Provide
the JCL and the program listing for the job.
Back to top
View user's profile Send private message
itzphaniz

New User


Joined: 02 Sep 2005
Posts: 39

PostPosted: Thu Apr 05, 2007 1:51 pm    Post subject:
Reply with quote

Ashwin-

It was typo. The second statement in include should be
Code:
1,14,CH,EQ,C'TTTTTTTFILETRL',OR,

and not
Code:
1,14,CH,EQ,C'TTTTTTTFILEHDR',OR,
. [/code]
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: Thu Apr 05, 2007 8:30 pm    Post subject:
Reply with quote

itzphaniz,

The B37-04 probably indicates that you didn't specify enough space on the T1 DD statement. T1 should be at least as large as your input file.
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 How to change 'K' or 'M' use Sort vice_versa DFSORT/ICETOOL 5 Thu May 18, 2017 7:11 am
No new posts Check if any Detail records and extra... V S Amarendra Reddy SYNCSORT 19 Mon May 08, 2017 8:54 pm
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
This topic is locked: you cannot edit posts or make replies. Merge two files and update Trailer re... Yashashri JCL & VSAM 1 Thu May 04, 2017 12:54 pm
This topic is locked: you cannot edit posts or make replies. SORT trick needed bshkris SYNCSORT 6 Tue May 02, 2017 4:35 am


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