How to execute job step reverse order

gunesh
Posts: 4
Joined: Wed Mar 06, 2013 10:49 pm
Skillset: jcl,vsam,cobol,db2,cics
Referer: web Search

How to execute job step reverse order

Postby gunesh » Wed Mar 06, 2013 11:29 pm

How to execute job step reverse order without use IEBEDIT utility?

enrico-sorichetti
Global moderator
Posts: 3006
Joined: Fri Apr 18, 2008 11:25 pm
Skillset: tso,rexx,assembler,pl/i,storage,mvs,os/390,z/os,
Referer: www.ibmmainframes.com

Re: JCL

Postby enrico-sorichetti » Wed Mar 06, 2013 11:36 pm

please a moderator move the topic to the stupid questions section :geek:
also why post a topic with the title jcl in the cobol section ???
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort

User avatar
Akatsukami
Global moderator
Posts: 1058
Joined: Sat Oct 16, 2010 2:31 am
Skillset: Rexx, JCL, DB2/SQL, TSO/ISPF, PL/I
Referer: ibmmainframes
Location: Bloomington, IL
Contact:

Re: JCL

Postby Akatsukami » Wed Mar 06, 2013 11:38 pm

You didn't read any of the rules for posting here, kusomushi, did you? :x

The answer is simply to use another tool, as Rexx or your shop's sort product, to rearrange the steps. Of course, even a software engineer would never actually do so foolish a thing.
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day

Robert Sample
Global moderator
Posts: 3720
Joined: Sat Dec 19, 2009 8:32 pm
Skillset: Systems programming, SAS, COBOL, CICS, JCL, SMS, VSAM, etc.
Referer: other forum
Location: Dubuque, Iowa, USA

Re: JCL

Postby Robert Sample » Thu Mar 07, 2013 12:14 am

enrico: topic moved.

gunesh: WHY would you want to do such a thing? Usually a job consists of a set of programs that are executed sequentially because the output of the first step is used by the program in the second step and so forth. Reversing the steps means you will have programs executing before their input data is available, or is not sorted correctly.

BillyBoyo
Global moderator
Posts: 3805
Joined: Tue Jan 25, 2011 12:02 am
Skillset: Easytrieve Plus, Cobol, Utilities, that sort of stuff
Referer: Google

Re: JCL

Postby BillyBoyo » Thu Mar 07, 2013 12:34 am

I think I'd use the editor, use M(ove) and A(fter) until the task is comlete. Then SUBmit. Then CANcel, as the whole thing seems pointless.

Ed Goodman
Posts: 341
Joined: Thu Feb 24, 2011 12:05 am
Skillset: 30 years on IBM mainframes
Referer: Searched for Frank Yeager

Re: How to execute job step reverse order

Postby Ed Goodman » Thu Mar 07, 2013 7:51 pm

Man, that is one DOOZY of a first post.

I spent a few minutes trying to decipher it, but no luck. The implication is that IEB* can do what they need. But I can't transform that into any useful tasks in my mind.

Do they really mean data?

gunesh
Posts: 4
Joined: Wed Mar 06, 2013 10:49 pm
Skillset: jcl,vsam,cobol,db2,cics
Referer: web Search

Re: How to execute job step reverse order

Postby gunesh » Fri Mar 08, 2013 11:46 am

I am fresher in mainframe and looking for job.

I know that it is foolish question,

But why this question asked during interview.

:)

enrico-sorichetti
Global moderator
Posts: 3006
Joined: Fri Apr 18, 2008 11:25 pm
Skillset: tso,rexx,assembler,pl/i,storage,mvs,os/390,z/os,
Referer: www.ibmmainframes.com

Re: How to execute job step reverse order

Postby enrico-sorichetti » Fri Mar 08, 2013 12:33 pm

that' s what usually foolish interviewers do ...
they ask foolish questions ;)

and ... why didn' t You say so from the beginning ???
( that it was an interview question You were asked )
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort

Ed Goodman
Posts: 341
Joined: Thu Feb 24, 2011 12:05 am
Skillset: 30 years on IBM mainframes
Referer: Searched for Frank Yeager

Re: How to execute job step reverse order

Postby Ed Goodman » Fri Mar 08, 2013 8:05 pm

From some of the horror stories I've heard from some of my sub-continental co-workers, I'd guess it was a set up.

Some companies are forced to interview people they don't want to hire, so they have questions like this. It allows them to say that none of the people who applied were able to answer the questions. Then they can hire the friend/cousin/brother that was already promised the job.

Sorry that's inflammatory, it's just what I've been told.

BillyBoyo
Global moderator
Posts: 3805
Joined: Tue Jan 25, 2011 12:02 am
Skillset: Easytrieve Plus, Cobol, Utilities, that sort of stuff
Referer: Google

Re: How to execute job step reverse order

Postby BillyBoyo » Sat Mar 09, 2013 7:13 am

Well, there's always DFSORT to the rescue:

Code: Select all

//STEP0100 EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SORTOUT  DD SYSOUT=*
//SYSIN    DD *
  OPTION EQUALS
  INREC IFTHEN=(WHEN=INIT,
  OVERLAY=(81:C'257')),
        IFTHEN=(WHEN=INIT,
                  PARSE=(%00=(STARTAFT=BLANKS,FIXLEN=5))),
        IFTHEN=(WHEN=INIT,
                  OVERLAY=(84:%00)),
        IFTHEN=(WHEN=GROUP,
                  BEGIN=(1,2,CH,EQ,C'//',
                     AND,3,1,CH,NE,C'*',
                     AND,84,4,CH,EQ,C'EXEC '),
                  PUSH=(81:ID=3))
  SORT FIELDS=(81,3,CH,D)
  OUTREC BUILD=(1,80)
                                                         
//SORTIN   DD DATA,DLM=ZZ
//TEXT JOB STUFF
// OTHER STUFF BEFORE FIRST STEP
// EXEC 1
//* EXEC PART OF STEP 1, BUT A COMMENT
// 1
// EXEC 2
// 2
// EXEC 3
// 3
ZZ


Produces this:

Code: Select all

//TEXT JOB STUFF                     
// OTHER STUFF BEFORE FIRST STEP     
// EXEC 3                             
// 3                                 
// EXEC 2                             
// 2                                 
// EXEC 1                             
//* EXEC PART OF STEP 1, BUT A COMMENT
// 1                                 


The record is "extended" by adding the characters "257" at position 81. 257 is more steps than you can have in a job. PARSE is then used to find the first field after one or more blanks, and five bytes are extracted. This is appended after the 257. WHEN=GROUP is used, starting if a JCL line and not a "comment" and the second extension is "EXEC ", to identify the start of a step. A 3-byte ID is PUSHed, overwriting the "257". This ID will be on all records of the group.

The data is SORTed, descending, with OPTION EQUALS, on the "257"/ID field, leaving the "job-related" statements at the top, and then producing the steps in reverse order.

This would only be of any use if there is no dependency in the steps from one to another.