View previous topic :: View next topic
|
Author |
Message |
venkat.bmw Warnings : 2 New User
Joined: 05 May 2009 Posts: 21 Location: India
|
|
|
|
I need to Access Natural EDIT COMMANDS thru JCL :
For example:
Consider a program - pgm1
pgm1:
DEFINE DATA LOCAL
1 #FIRST (N1)
1 #SHIP (N1)
END-DEFINE
IF #FIRST = 2
ADD 1 TO #SHIP
END-IF
DISPLAY #SHIP
END
This above program i need to access thru jcl and then using edit command
'CHANGE' , i need replace #SHIP to #SECOND . Any options ?? |
|
Back to top |
|
|
venkat.bmw Warnings : 2 New User
Joined: 05 May 2009 Posts: 21 Location: India
|
|
|
|
Not only CHANGE .. you can tell some other EDIT commands also |
|
Back to top |
|
|
abhi484u Warnings : 1 New User
Joined: 31 Aug 2006 Posts: 9
|
|
|
|
//STEP01 EXEC NATURALD,COND=(3,LT),
// OPT='MADIO=0,MT=0,AUTO=ON,WH=ON,ETID=CSEL200'
//SYSIN DD *
LOGON <libraryname>
SCAN
S
<scanvalue>
<replace value>
<libraryname>
<programname>
P /* P for Program
Y /* Y for absolute scan
FIN
/*
hopw this will save you purpose |
|
Back to top |
|
|
abhi484u Warnings : 1 New User
Joined: 31 Aug 2006 Posts: 9
|
|
|
|
I also tried like
//STEP01 EXEC NATURALD,COND=(3,LT),
// OPT='MADIO=0,MT=0,AUTO=ON,WH=ON,ETID=CSEL200'
//SYSIN DD *
LOGON <libraryname>
E <programname>
SCAN FUNC=S SVAL=value1 RVAL=value2 LIB=SYSTEM TYPE=P OBJ=<program>
FIN
But it is not working...no idea why |
|
Back to top |
|
|
venkat.bmw Warnings : 2 New User
Joined: 05 May 2009 Posts: 21 Location: India
|
|
|
|
We can correct the programs easily without any long procedures n approvals... |
|
Back to top |
|
|
abhi484u Warnings : 1 New User
Joined: 31 Aug 2006 Posts: 9
|
|
|
|
Sorry I didn't get what u meant... |
|
Back to top |
|
|
venkat.bmw Warnings : 2 New User
Joined: 05 May 2009 Posts: 21 Location: India
|
|
|
|
Suppose if we are moving wrong code to PROD .. then tis JCL we can correct the programs easily ... |
|
Back to top |
|
|
ofer71
Global Moderator
Joined: 27 Dec 2005 Posts: 2358 Location: Israel
|
|
|
|
The SCAN-REPLACE option would be my favorite.
In addition, you can write a "driver" program to manipulate and run sources using the USR2014 user exit.
Also, take a look at the EDT command.
O. |
|
Back to top |
|
|
venkat.bmw Warnings : 2 New User
Joined: 05 May 2009 Posts: 21 Location: India
|
|
|
|
I think using EDT command ,we can write new pgm but we cant make changes in existing program !!!! |
|
Back to top |
|
|
ofer71
Global Moderator
Joined: 27 Dec 2005 Posts: 2358 Location: Israel
|
|
|
|
Not true. EDT works fine with existing source.
O. |
|
Back to top |
|
|
Ralph Zbrog
New User
Joined: 21 Nov 2009 Posts: 58 Location: California
|
|
|
|
This is a bad idea.
SCAN was intended for mass changes, for example to replace #FIELD-NAME1 with #FIELD-NAME2 in all modules in a library. It does not allow much in the selection of lines.
The batch editor, invoked with EDT, is suited to creating new programs. Although you can scan for a text string, there is no REPLACE function, so you have to supply a replacement line or a new line for insertion. That means that you have to know exactly what the code looks like beforehand.
USR1014N gives you full functionality of the Natural editor, but would be overkill for the type of change suggested by venkat.bmw.
Be careful. All of these techniques can easily run you into trouble.
And finally, none of these techniques should be used to manipulate production code! Every one of my clients would consider such an attempt cause for dismissal. I'm surprised that this is even possible in your shop; your Natural Security profile should disallow SAVE and CAT commands in the production environment. Use your standard migration procedures to fix production code. |
|
Back to top |
|
|
venkat.bmw Warnings : 2 New User
Joined: 05 May 2009 Posts: 21 Location: India
|
|
|
|
Hey Ralph Zbrog,
Thank for ur advice . This is jus a try !! a new way .... we are not gonna follow tis .. but tis will help us to know the flexibility of natural |
|
Back to top |
|
|
abhi484u Warnings : 1 New User
Joined: 31 Aug 2006 Posts: 9
|
|
|
|
I am also against editing of production code directly witha batch.
But you got an nice alternative, but it is a raw form of editing and idea is to read and edit the FUSER ADABAS file.
But never ever I suggest this except for efficient search methdologies. Thanks |
|
Back to top |
|
|
ofer71
Global Moderator
Joined: 27 Dec 2005 Posts: 2358 Location: Israel
|
|
|
|
Quote: |
but tis will help us to know the flexibility of natural |
Natural's nickname is flexible, sometimes even too-flexible
O. |
|
Back to top |
|
|
venkat.bmw Warnings : 2 New User
Joined: 05 May 2009 Posts: 21 Location: India
|
|
|
|
Hey guys .. come on !! .. Pls stop voting ( Against or not ) ... Think abt the solution !!!!!!! |
|
Back to top |
|
|
Ralph Zbrog
New User
Joined: 21 Nov 2009 Posts: 58 Location: California
|
|
|
|
It's a long, difficult road from rookie to journeyman to expert. To achieve the highest level, you need to know what Natural can do, when to use specific features, and when not to use them. From an educational perspective, a valid question was posed (and it was answered), but any suggestion of manipulating production code must be answered with a strong warning.
I have had little use for SCAN/REPLACE, and I don't like that it provides no audit trail. EDT is fine for uploading source to mainframe Natural - from a PDS member or flat file - but it's too cumbersome for changing code. USR2014N is great for source code-generating utilities. But I would not use these techniques to maintain/modify existing code. For mass changes, Natural Engineer is a better solution.
Rather than edit in batch, make and test the code changes on-line, export the modified source to a flat file, and load the flat file into the target environment as a complete module via EDT (presuming that you can't use standard procedures, like SYSMAIN, SYSOBJH, PAC, or N2O). |
|
Back to top |
|
|
anilscomputer
New User
Joined: 26 May 2008 Posts: 7 Location: Trivandrum
|
|
|
|
Eagar,
From the prev post there is a tedious way to get around the question
load the pgm into a flat file change it using jcl save it back to work area. ( provided the pgm name should be diffrent)
Warning!! Solution not to be practiced as it is not the correct way and doesnt give audit trail |
|
Back to top |
|
|
atulbagewadikar
New User
Joined: 15 Jun 2006 Posts: 26
|
|
|
|
If you're submitting a JCL (batch) against NATPROD (production) with your user id, is not wise to modify source online using editor? (I believe if you have right to submit a batch against prod then you should be able to logon to NATPROD too).
Of course this is not a wise solution! |
|
Back to top |
|
|
venkat.bmw Warnings : 2 New User
Joined: 05 May 2009 Posts: 21 Location: India
|
|
|
|
Atul,
U r thinking og test jobs but we can use user request jobs .. Tis jobs will have access to update !!!!! |
|
Back to top |
|
|
|