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
 
Execute same step n times with variable dsn

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
donevin

New User


Joined: 07 Jun 2005
Posts: 70
Location: South Africa

PostPosted: Tue Sep 04, 2007 2:40 am    Post subject: Execute same step n times with variable dsn
Reply with quote

I've seen similar questions in the forum but none exactly addresses the situation I face. I hope someone can help.

I have a job that sends a file to a printer. Before this job executes, another job creates the input for this job and the number of files varies from run to run. I can do a LISTCAT to get all the filenames that were created. I can only send one file at a time to the printer because of size constraints. I want to dynamically pass the created dataset names one by one to the send job and execute the job for each file that is passed to it. I have permission to change the send job. Any ideas?
Back to top
View user's profile Send private message

dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Tue Sep 04, 2007 5:33 am    Post subject:
Reply with quote

Hello,

You could read the dataset containing the filenames creating jcl "on the fly" for each "send". You could create one job with multiple steps or multiple jobs that process one file each.

The jcl you dynamically create, would be "written" to the internal reader.

If i've not understood your request, please clarify.
Back to top
View user's profile Send private message
donevin

New User


Joined: 07 Jun 2005
Posts: 70
Location: South Africa

PostPosted: Tue Sep 04, 2007 5:01 pm    Post subject:
Reply with quote

Hi Dick

Thanks for the reply. I suppose in your reply you're referring to accomplish this through COBOL? Am I right? I am including the guts of a program I wrote. The reason I am doubting this program is because I cannot get the JCL that's submitted from the program to abend. I need to see what the output will be if this job should abend. Any comments is appreciated.

Code:

 PERFORM VARYING WS-FNAMES-CNT FROM 1 BY 1 UNTIL             
                 WS-FNAMES-CNT > WS-NOF-FNAMES             
                                                           
 OPEN OUTPUT JOB-OUT                                         
    IF WS-FILE-STATUS NOT = "00"                           
        DISPLAY "JOB-OUT OPEN ERROR ; STATUS = "           
                                              WS-FILE-STATUS
        PERFORM ZPJFW-ABORT-HALT                           
    END-IF                                                 
*   Send JCL to output                               
    PERFORM VARYING WS-NOF-CARDS FROM 1 BY 1 UNTIL         
                    WS-NOF-CARDS > WS-CARDS-CNT             
*  Change "DSN=" in JCL                               
        IF DD-NAME (WS-NOF-CARDS) = "SYSUT1"               
            MOVE WS-FILENAME (WS-FNAMES-CNT)               
                            TO DSN-NAME (WS-NOF-CARDS)     
        END-IF                                             
        MOVE WS-JOB-CARD (WS-NOF-CARDS)                     
                            TO JOB-OUT-REC                 
*  To force a JCL error.           
        MOVE ALL "X"        TO JOB-OUT-REC                 
        WRITE JOB-OUT-REC                                   
    END-PERFORM                                             
*  Submit job automatically to JES via Internal Reader     
    CLOSE JOB-OUT                                           
    IF WS-FILE-STATUS NOT = "00"     
        DISPLAY "JOB-OUT CLOSE ERROR ; STATUS = "           
                                              WS-FILE-STATUS
        PERFORM ZPJFW-ABORT-HALT                           
    END-IF                                                 
END-PERFORM.


My jcl follows :

Code:

//STEPRUN  EXEC PGM=SPLITFIL,COND=(0,GT)                               
//*                                                                     
//STEPLIB  DD DSN=MY.STEP.LIB,DISP=SHR                       
//SYSOUT   DD  SYSOUT=*                                                 
//SYSABOUT DD  SYSOUT=*                                                 
//IDCAMS   DD  SYSOUT=*                                                 
//CEEDUMP  DD  SYSOUT=*                                                 
//*                                                                     
//JOBIN    DD DSN=MY.JCL.PDS(SENDJOB),DISP=SHR               
//FNAMES   DD DSN=MY.INPUT.FILENAMES.SEQ,                       
//         DISP=SHR                                                     
//JOBOUT   DD SYSOUT=(A,INTRDR)                                         
//*---------------------------------------------------------------------
Code:
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Tue Sep 04, 2007 7:07 pm    Post subject:
Reply with quote

You're welcome icon_smile.gif

COBOL works well. You could use other tools also. . .

Quote:
The reason I am doubting this program is because I cannot get the JCL that's submitted from the program to abend
I'm not clear on why the submitted jcl needs to abend icon_confused.gif

One way to see the output of an abend is to compile a "special" version of the program that will be run within the submitted jcl, and cause an 0c7.

It appears thet the JOB statement will be written too many times. The XXXXX's statement could cause a jcl error, but should not cause an abend.

If you post the output of the program (rather than sending it thru the internal reader), that may help as well..
Back to top
View user's profile Send private message
donevin

New User


Joined: 07 Jun 2005
Posts: 70
Location: South Africa

PostPosted: Tue Sep 04, 2007 8:25 pm    Post subject:
Reply with quote

Me again Dick

I've taken note of the points you've raised. Regarding the job statement, do you suggest submitting only the step from the second submission onwards? Can you submit a step on it's own to the Internal Reader? Ive decided to take the COBOL route to solve this situation. Thank you very much for your input 'till now.
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Tue Sep 04, 2007 8:30 pm    Post subject:
Reply with quote

You can submit only JOBS to the internal reader not individual steps.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Tue Sep 04, 2007 8:36 pm    Post subject:
Reply with quote

Hello again icon_smile.gif

Quote:
Regarding the job statement, do you suggest submitting only the step from the second submission onwards?
I suggest submitting one job with "all of the steps" or several jobs with one step each - whichever better suits your requirement.

Ooops, I was reading the code incorrectly icon_confused.gif Too quickly, i read WS-JOB-CARD as the JOB statement icon_redface.gif

Is your question about an abend resolved?

Quote:
Can you submit a step on it's own to the Internal Reader?
No, when you submit, a JOB needs to be submitted.
Back to top
View user's profile Send private message
donevin

New User


Joined: 07 Jun 2005
Posts: 70
Location: South Africa

PostPosted: Tue Sep 04, 2007 8:50 pm    Post subject:
Reply with quote

Thanks guys

My question about the abend is not really solved. I tried to abend the job so I could see where the output of the abend would be and what it will look like.
Back to top
View user's profile Send private message
bijumon

New User


Joined: 14 Aug 2006
Posts: 20
Location: Pune,India

PostPosted: Fri Sep 07, 2007 4:54 pm    Post subject: Reply to: Execute same step n times with variable dsn
Reply with quote

Hi donevin,

you can also try using an array, to build the JOB, i.e. the entire job, and then (instead of using write), you can use a Perform Until, and just display wahtever is in the array, this was you can build the entire JCL and then finally do a submit to the INTRDR. As the sysout is mapped to the INDRDR in the JCL the next job would be submitted.



Please get back if iam not clear.


Thanks,
---------
Biju.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri Sep 07, 2007 9:10 pm    Post subject:
Reply with quote

Hello,

Quote:
My question about the abend is not really solved. I tried to abend the job so I could see where the output of the abend would be and what it will look like.
You could make a version of the program that will intentionally cause a s0c7. You would then see what happens to with the output.
Back to top
View user's profile Send private message
Bitneuker

CICS Moderator


Joined: 07 Nov 2005
Posts: 1105
Location: The Netherlands at Hole 19

PostPosted: Sat Sep 08, 2007 12:32 am    Post subject: Re: Execute same step n times with variable dsn
Reply with quote

donevin wrote:
I want to dynamically pass the created dataset names one by one to the send job and execute the job for each file that is passed to it. I have permission to change the send job. Any ideas?


Following this topic I got lost......... If the quotet is all wouldnt a symbolic parameter do? This parameter might be generated by a job to submit the receiving job via the internal reader......... Or do I completely miss the point ( i.s S0C7???????????)
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Sun Sep 09, 2007 4:01 am    Post subject:
Reply with quote

Hi George,

Quote:
Or do I completely miss the point
I believe you "have" the point. As the job(s) are submitted thru the internal reader, i believe generating the value for a symbolic parameter should work pretty much the same as generating the dsn in the dd.

Much of the topic concerned seeing what happens if the submitted job abends, so we sort of got away from the main question.
Back to top
View user's profile Send private message
donevin

New User


Joined: 07 Jun 2005
Posts: 70
Location: South Africa

PostPosted: Mon Sep 10, 2007 8:38 pm    Post subject:
Reply with quote

For some reason I don't get alerts on topics that I watch anymore. Anyway, I've actually tested and handed this solution over to the person who needed help. The JCL that had to be changed on the fly is quite small and so this job is running quite fine. I had to reduce the jobs to one since I was testing on Mainframe Express and am only allowed to submit one job to the INTRDR per run. I want to ask a question Biju, if you don't mind? How exactly would the submit to the INTRDR take place as indicated by you in your response? Thanks again guys for all your input.
Back to top
View user's profile Send private message
Bitneuker

CICS Moderator


Joined: 07 Nov 2005
Posts: 1105
Location: The Netherlands at Hole 19

PostPosted: Mon Sep 10, 2007 11:35 pm    Post subject:
Reply with quote

From the dear JCL manual: SYSOUT and INTRDR
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 -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts it is possible output a SET value fro... Martylin JCL & VSAM 5 Fri Sep 22, 2017 7:08 am
No new posts Moving values to a variable of copybo... Vignesh Sid COBOL Programming 6 Wed Sep 06, 2017 1:04 pm
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 Move from Comp3 variable to Edited Va... sreekusr COBOL Programming 8 Thu Aug 10, 2017 4:20 pm

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