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

How to substring a new dataset name from a old one?


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

New User


Joined: 06 Mar 2015
Posts: 31
Location: china

PostPosted: Tue Feb 19, 2019 12:00 pm
Reply with quote

Dear all,

background:
I am now writing a data set triggered OPC appl which only contains 1 UNLOAD JCL.
This OPC's data set trigger varies, for example:
TFMS.F.DD.FMSNT99C.NLGRAIW.REV1.TRIGGER
TFMS.F.DD.FMSNT99C.NLGRAIW.W301.TRIGGER
TFMS.F.DD.FMSNT99C.NLGRAIW.GS02.TRIGGER
........

In the unload JCL head, it has:
//*%OPC SCAN
// SET TRIGNAM=%OETEVNM
//*%OPC BEGIN ACTION=NOSCAN

which means if the OPC is trigger by any of above data sets, the trigger data set name will be fetched from OPC system and gives the value to the variable TRIGNAM.
for example, it will change to below if run in OPC:

//*%OPC SCAN
// SET TRIGNAM=TFMS.F.DD.FMSNT99C.NLGRAIW.REV1.TRIGGER
//*%OPC BEGIN ACTION=NOSCAN
.............................
//*%OPC SCAN
// SET TRIGNAM=TFMS.F.DD.FMSNT99C.NLGRAIW.W301.TRIGGER
//*%OPC BEGIN ACTION=NOSCAN



My question:

In the followed step there is 1 unload step and the unloaded data set name should be the trigger name without the last qualifier 'TRIGGER', for example:
TFMS.F.DD.FMSNT99C.NLGRAIW.REV1
TFMS.F.DD.FMSNT99C.NLGRAIW.W301
TFMS.F.DD.FMSNT99C.NLGRAIW.GS02
.......

how can i only fetch the qualifiers from trigger data set name only without last qualifier 'TRIGGER'? not hard-coded way, because REV1 trigger only generates REV1 data set, W301 trigger only generates W301 data set.
The unloaded data set name varies according to trigger name.

thank you!
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Tue Feb 19, 2019 3:11 pm
Reply with quote

Do the simpler and more easily maintainable thing and treat each function as a separate job - not three rolled into 1.
Back to top
View user's profile Send private message
javen777

New User


Joined: 06 Mar 2015
Posts: 31
Location: china

PostPosted: Wed Feb 20, 2019 7:22 am
Reply with quote

Nic Clouston wrote:
Do the simpler and more easily maintainable thing and treat each function as a separate job - not three rolled into 1.


Thanks for the reply Nic, better to achieve this function for easy maintainance in the future icon_smile.gif
Back to top
View user's profile Send private message
David Robinson

Active User


Joined: 21 Dec 2011
Posts: 197
Location: UK

PostPosted: Wed Feb 20, 2019 4:00 pm
Reply with quote

Two ways that spring to mind, depending on whether you want the bulk of the code within your JCL or set up within the TWS dialogs.

For option 1, you'd need three sets of //*%OPC BEGIN ACTION=INCLUDE statements along with a COMP keyword to test the value of the OETEVNM variable in each case. For whichever of the three was true, subsequent lines of JCL would then be included to SET the value of TRIGNAM to the desired dataset name.

For option 2, set up a JCL variable table (option 1.9 from the primary TWS menu). Define the "dependent" variable as TRIGNAM and the "independent" variable as OETEVNM. Then you can say if the value of OETEVNM is TFMS.F.DD.FMSNT99C.NLGRAIW.REV1.TRIGGER then the value of TRIGNAM will be TFMS.F.DD.FMSNT99C.NLGRAIW.REV1, etc.

The other question of course is why not do the triggering on the base dataset in the first place? What is the purpose of the TRIGGER dataset? The application is not triggerred until the dataset is closed, so there are no concerns about only processing an incomplete dataset, etc.
Back to top
View user's profile Send private message
javen777

New User


Joined: 06 Mar 2015
Posts: 31
Location: china

PostPosted: Thu Feb 21, 2019 8:52 am
Reply with quote

David Robinson wrote:
Two ways that spring to mind, depending on whether you want the bulk of the code within your JCL or set up within the TWS dialogs.

For option 1, you'd need three sets of //*%OPC BEGIN ACTION=INCLUDE statements along with a COMP keyword to test the value of the OETEVNM variable in each case. For whichever of the three was true, subsequent lines of JCL would then be included to SET the value of TRIGNAM to the desired dataset name.

For option 2, set up a JCL variable table (option 1.9 from the primary TWS menu). Define the "dependent" variable as TRIGNAM and the "independent" variable as OETEVNM. Then you can say if the value of OETEVNM is TFMS.F.DD.FMSNT99C.NLGRAIW.REV1.TRIGGER then the value of TRIGNAM will be TFMS.F.DD.FMSNT99C.NLGRAIW.REV1, etc.

The other question of course is why not do the triggering on the base dataset in the first place? What is the purpose of the TRIGGER dataset? The application is not triggerred until the dataset is closed, so there are no concerns about only processing an incomplete dataset, etc.


thanks for the reply David.

the reason why not do the triggering on the base dataset int the first place , is it's used for the next job to process, so cannot use it as trigger, also it's the purpose of the TIRGGER dataset.

so any idea?
Back to top
View user's profile Send private message
javen777

New User


Joined: 06 Mar 2015
Posts: 31
Location: china

PostPosted: Thu Feb 21, 2019 8:54 am
Reply with quote

David Robinson wrote:
Two ways that spring to mind, depending on whether you want the bulk of the code within your JCL or set up within the TWS dialogs.

For option 1, you'd need three sets of //*%OPC BEGIN ACTION=INCLUDE statements along with a COMP keyword to test the value of the OETEVNM variable in each case. For whichever of the three was true, subsequent lines of JCL would then be included to SET the value of TRIGNAM to the desired dataset name.

For option 2, set up a JCL variable table (option 1.9 from the primary TWS menu). Define the "dependent" variable as TRIGNAM and the "independent" variable as OETEVNM. Then you can say if the value of OETEVNM is TFMS.F.DD.FMSNT99C.NLGRAIW.REV1.TRIGGER then the value of TRIGNAM will be TFMS.F.DD.FMSNT99C.NLGRAIW.REV1, etc.

The other question of course is why not do the triggering on the base dataset in the first place? What is the purpose of the TRIGGER dataset? The application is not triggerred until the dataset is closed, so there are no concerns about only processing an incomplete dataset, etc.


for option 1 and 2 i got your point, and it's already solved by setting all 3 files as trigger and i only need a part of the trigger name, for short.
Back to top
View user's profile Send private message
David Robinson

Active User


Joined: 21 Dec 2011
Posts: 197
Location: UK

PostPosted: Fri Feb 22, 2019 9:57 pm
Reply with quote

I'm sorry, but I don't understand either of your replies. Is there another question in there somewhere?
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 Printing a dataset in DUMP format wit... ABENDS & Debugging 2
No new posts Capture GDG Dataset Name JCL & VSAM 10
No new posts Fetch the Dataset names from inside m... TSO/ISPF 18
No new posts what is the DSORG(Datset orgnisation)... JCL & VSAM 8
No new posts IEBGENER is not Creating Member in PD... JCL & VSAM 7
Search our Forums:

Back to Top