IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to using JCL to modify a PS record ?


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Lord.of.Wind

New User


Joined: 17 Nov 2005
Posts: 60

PostPosted: Tue Nov 07, 2006 3:54 pm
Reply with quote

Hi, all:

In JCL, is there any command can modify a field in a PS file?
For instance, copybook of the record is:

Code:

01 Header.
    05 header-name pic x(10) value 'Header'.
01 Details
        05 Name  pic x(8).
        05 gender pic x(1).
        05 age     pic 9(2).
01 Trailer.
     05 trailer-name      pic x(10) value 'Trailer'.
     05 average-of-age  pic 9(2).


Using JCL, can the following file be modified?

Header
John M20
Mary F21
Mike M22
Trailer 21
---->
Header
John M20
Mary F20
Mike M20
Trailer 20


Thank you.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Tue Nov 07, 2006 10:43 pm
Reply with quote

Here's a DFSORT job that will do what you asked for:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (FB)
//SORTOUT DD DSN=... output file (FB)
//SYSIN    DD    *
  OPTION COPY
  INREC IFTHEN=(WHEN=(1,10,CH,NE,C'Header',AND,             
    1,10,CH,NE,C'Trailer'),OVERLAY=(10:C'20')),             
   IFTHEN=(WHEN=(1,10,CH,EQ,C'Trailer'),OVERLAY=(11:C'20')) 
/*


If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:

Use [URL] BBCode for External Links
Back to top
View user's profile Send private message
Lord.of.Wind

New User


Joined: 17 Nov 2005
Posts: 60

PostPosted: Wed Nov 08, 2006 12:00 pm
Reply with quote

Thank you and superK very much!

Could I ask it in more detail?
I want to read a variable length file and write another variable length file.
They have the same definition as the following:

Code:
Organization  . . . : PS   
Record format . . . : VB   
Record length . . . : 27994
Block size  . . . . : 27998


In the input file:
----------------------------------------------------------------------------
000001 HEADER
......
TRA00500GCB2006110220061102132230890000007EQ040BL1T
000002 TRA00500TRANOUT GCB 00000000095 00000000095A0510497130400710000
000003 TRA00500TRANOUT GCB 00000000096 00000000096A0510497130400710000
000004 TRA00500TRANOUT GCB 00000000097 00000000097A0510497130400710000
000076 TRA00500TRADETAX +00000000167 B +00000000167BA +0510497130400+
000077 TRA00500TRANOUT GCB 00000000168 00000000168A0510497130400727319
000078 TRA00500TRADETAX +00000000168 B +00000000168BA +0510497130400+
000079 TRA00500TRANOUT GCB 00000000169 00000000169A0510497130400727319
000080 TRA00500TRADETAX +00000000169 B +00000000169BA +0510497130400+
000081 TRA00500TRANOUT GCB 00000000170 00000000170A0510497130400727319
......
000097 TRAILER TRA005002006110213223089 000000095000000 95 is the record counter.
----------------------------------------------------------------------------
Header, trailer and records with TRANOUT should be copied directly, records with TRADETAX should be bypassed.
At last, calcute the record count again, write the count(<95) into trailer.

How to do it in DFSORT?

Many thanks!
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Wed Nov 08, 2006 9:15 pm
Reply with quote

Quote:
records with TRADETAX should be bypassed


Does this mean you don't want records with TRADETAX to appear in the output file?

Quote:
At last, calcute the record count again, write the count(<95) into trailer.


Does the count include the header and trailer records, or just the detail records. That is, for:

Header
detail
detail
Trailer

is the count 4 (all records) or 2 (just the detail records)?

Is the count to be replaced 9 digits (000000095) or 2 digits (95)?
Back to top
View user's profile Send private message
Lord.of.Wind

New User


Joined: 17 Nov 2005
Posts: 60

PostPosted: Thu Nov 09, 2006 11:48 am
Reply with quote

Hi, Frank

Thanks for your help.
Yes, I do not want records with TRADETAX appear in the output file.
Header and trailer records are to be counted with detail records.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts To find whether record count are true... DFSORT/ICETOOL 6
No new posts Validating record count of a file is ... DFSORT/ICETOOL 13
Search our Forums:

Back to Top