Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
How to using JCL to modify a PS record ?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: How to using JCL to modify a PS record ?
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 Moderator


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

PostPosted: Tue Nov 07, 2006 10:43 pm    Post subject:
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:

www.ibm.com/servers/storage/support/software/sort/mvs/srtmpub.html
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    Post subject:
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 Moderator


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

PostPosted: Wed Nov 08, 2006 9:15 pm    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Updating the Trailer count in variabl... satheshbabur DFSORT/ICETOOL 6 Wed Aug 30, 2017 9:49 pm
No new posts Repeat part of record multiple times Learncoholic DFSORT/ICETOOL 4 Tue Aug 29, 2017 11:33 am
No new posts Read two inputs and write into output... murali.andaluri DFSORT/ICETOOL 6 Wed Jul 26, 2017 7:35 pm
No new posts Need to write record of PS File in ex... Chandan1993 JCL & VSAM 1 Wed Jun 07, 2017 1:35 am
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us