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

Can we modify a PS file in JCL?


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Priyanka Pyne

New User


Joined: 09 Feb 2008
Posts: 95
Location: India

PostPosted: Thu Feb 14, 2013 3:16 pm
Reply with quote

Hi,

I am trying to modify a FILE1 through JCL which is created say in setp01.

In step02 I want to change first two line of that FILE1 with two specific lines. I don't want to do it manually since this needs to be done for 11 files. Also I don't want to write any COBOL code.

But, really not sure if this can be done using JCL. Any help will be great.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Thu Feb 14, 2013 3:18 pm
Reply with quote

No, because JCL merely informs the CPU which program to process and which files to use.

So you will need to write some sort of code at some stage

SAS, REXX, ISPF Edit, SORT, COBOL, PL/1 ......... whatever
Back to top
View user's profile Send private message
Priyanka Pyne

New User


Joined: 09 Feb 2008
Posts: 95
Location: India

PostPosted: Thu Feb 14, 2013 3:22 pm
Reply with quote

Can I do this using Sort? if yes can you show me some path?
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Thu Feb 14, 2013 3:45 pm
Reply with quote

You need to tell us EXACTLY what it is that you want to do to get any useful assistance.
Back to top
View user's profile Send private message
Priyanka Pyne

New User


Joined: 09 Feb 2008
Posts: 95
Location: India

PostPosted: Thu Feb 14, 2013 3:49 pm
Reply with quote

I have one control card

In that file the first two lines are
Code:
LOAD DATA LOG NO INDDN SYSREC00 INTO TABLE
    XXX.TABLE 



I want to modify this with
Code:
LOAD DATA INDDN SYSREC REPLACE LOG NO NOCOPYPEND
INTO TABLE XXX.TABLE


This control card is getting generated in step1. And I am using it in step2. But before using I want to do the above modification.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Feb 14, 2013 4:08 pm
Reply with quote

Code:
  OPTION COPY
  INREC IFTHEN=(WHEN=(1,42,CH,EQ,
                       C'LOAD DATA LOG NO INDDN SYSREC00 INTO TABLE'),
         OVERLAY=(C'LOAD DATA INDDN SYSREC REPLACE LOG NO NOCOPYPEND')),
        IFTHEN=(WHEN=NONE,BUILD=(C'INTO TABLE',5,63))

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

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Thu Feb 14, 2013 4:19 pm
Reply with quote

Why not just generate the card correctly in STEP1
Back to top
View user's profile Send private message
Priyanka Pyne

New User


Joined: 09 Feb 2008
Posts: 95
Location: India

PostPosted: Thu Feb 14, 2013 5:49 pm
Reply with quote

Thanks. It worked.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Feb 14, 2013 6:05 pm
Reply with quote

You mean correcting STEP1? It is the best option.
Back to top
View user's profile Send private message
Priyanka Pyne

New User


Joined: 09 Feb 2008
Posts: 95
Location: India

PostPosted: Thu Feb 14, 2013 6:45 pm
Reply with quote

No. I did what Bill suggested. Because correcting Step1 is not possible as it is getting generated automaticcaly while I am taking unload of table.
Back to top
View user's profile Send private message
Priyanka Pyne

New User


Joined: 09 Feb 2008
Posts: 95
Location: India

PostPosted: Fri Feb 15, 2013 1:33 pm
Reply with quote

Another problem I am facing.

I used the below card
Code:
IFTHEN=(WHEN=(7,4,CH,EQ,C'WLTC'),
OVERLAY=(C'EFGH    '))           


Input:
Code:
     WLTCSYSX.table


I expected
Code:
      EFGHSYSX.table


But it is coming as
Code:
EFGH    TCSYSX.Table


Someone please put some light on it
Back to top
View user's profile Send private message
chandan.inst

Active User


Joined: 03 Nov 2005
Posts: 275
Location: Mumbai

PostPosted: Fri Feb 15, 2013 1:48 pm
Reply with quote

Try this.

Code:
IFTHEN=(WHEN=(7,4,CH,EQ,C'WLTC'),
BUILD=(1,6,C'EFGH',11,10))         


YOu cam make use of FINDREP also for this requirement
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Feb 15, 2013 2:02 pm
Reply with quote

Priyanka,

If you don't specify a Column in OVERLAY, the default is "1". There is no "where I want it to go, could be different each time" default.

Code:
IFTHEN=(WHEN=(7,4,CH,EQ,C'WLTC'),
          OVERLAY=(7:C'EFGH'))         


Quote:
You cam make use of FINDREP also for this requirement


Chandan,

BUILD will always generate a new version of a record. OVERLAY won't unless the record is extended. BUILD always has to specify fields for all the data and the thing being changed. OVERLAY only the things being changed, so less open to typos and other assorted mistakes.

Why would you use FINDREP for that?
Back to top
View user's profile Send private message
chandan.inst

Active User


Joined: 03 Nov 2005
Posts: 275
Location: Mumbai

PostPosted: Fri Feb 15, 2013 2:08 pm
Reply with quote

Bill,

Apologies..my posy bit unclear..

I meant to say if Priyanka doesn't want to make use of IFTHEN BUILD,she can make use of FINDREP also..

Thanks for explanation on Build and overlay..
Will keep in mind that if we are not going to extend the record its better to use overlay

Regards,
Chandan
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Feb 15, 2013 2:17 pm
Reply with quote

Ok, but FINDREP is FIND and REPlace. IFTHEN=(WHEN=(logexp is "it's here, I don't need to go searching for it" (if not using SS as a fieldtype).

It will make the code less clear (and slower) to use FINDREP where IFTHEN is much more obvious.
Back to top
View user's profile Send private message
chandan.inst

Active User


Joined: 03 Nov 2005
Posts: 275
Location: Mumbai

PostPosted: Fri Feb 15, 2013 3:11 pm
Reply with quote

Yes Bill..Agree with you ..Thanks
Back to top
View user's profile Send private message
Priyanka Pyne

New User


Joined: 09 Feb 2008
Posts: 95
Location: India

PostPosted: Fri Feb 15, 2013 3:30 pm
Reply with quote

Thank you all. Overlay worked for me. I think we can use the following as well.


Code:
INREC OVERLAY=(5:5,5,CHANGE=(5,C'12345',C'ABCDE'),NOMATCH=(5,5))
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Feb 15, 2013 4:33 pm
Reply with quote

Yes, CHANGE would be possible. However, again I think it loses clarity as CHANGE would usually be fore more than one transformation.

CHANGE doesn't get used nearly enough, so good work in getting to it.
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Access to non cataloged VSAM file JCL & VSAM 18
Search our Forums:

Back to Top