Sort

In this Mainframe Forum - You can post your queries on JCL, OS/390 JCL, MVS JCL, z/OS JCL, JES2 & JES3

Moderators: Frank Yaeger, DikDude, Moderator Group

Post Reply
venky
Active Member
Posts: 50
Joined: Sat May 12, 2012 10:13 pm

Sort

Post by venky » Fri Nov 09, 2012 11:48 pm

Hi,

I have a requirement, if a file is not sorted in patricular position then it should abend.

for example: the file is of 80 bytes, from positon 1-9 we need to sort the file, if it is not sorted then it should get abend.

Please help by using Jcl.

Regards,
Venky.

William Collins
Active Member
Posts: 732
Joined: Thu May 24, 2012 4:07 am

Post by William Collins » Sat Nov 10, 2012 12:07 am

You are not being really clear.

Do you want to check that a file is in sorted sequence, and do something if it is not?

If a file is SORTed, then it will be in the sequence you have told it to be.

So, what is it that you actually want?

DikDude
Moderator
Posts: 1001
Joined: Fri Jul 22, 2011 8:39 am
Location: usa

Post by DikDude » Sat Nov 10, 2012 12:10 am

If you need to sort the file - sort it. . .

Why bother trying to determine if it is already in sequence if the goal is a sorted output file?
Have a good one

venky
Active Member
Posts: 50
Joined: Sat May 12, 2012 10:13 pm

Post by venky » Sat Nov 10, 2012 1:16 am

Hi Willams,

Yes, if the file is not in sorted order(assecending or descending) then i need to get jcl error after submitting the jcl. I need a condition if the file is not sorted then it should get jcl error. Thanks.

Regards,
Venky.

William Collins
Active Member
Posts: 732
Joined: Thu May 24, 2012 4:07 am

Post by William Collins » Sat Nov 10, 2012 2:01 am

OK. Use MERGE. The input file DD must be SORTIN01. Specify the key you want. If the file is not in key sequence, you will get RC=16 and ICE068A 0 OUT OF SEQUENCE SORTIN01.

DikDude
Moderator
Posts: 1001
Joined: Fri Jul 22, 2011 8:39 am
Location: usa

Post by DikDude » Sat Nov 10, 2012 2:05 am

I need a condition if the file is not sorted then it should get jcl error.
You have not yet explained why this is a "requirement".
from positon 1-9 we need to sort the file
If the file needs to be sorted, it makes no sense to end the run rather than simply sorting the data.

Whatever is really needed, do not plan on causing a JCL error. You can terminate the job by a condition code test, but a JCL error makes No sense.
Have a good one

venky
Active Member
Posts: 50
Joined: Sat May 12, 2012 10:13 pm

Post by venky » Sat Nov 10, 2012 10:04 pm

dikdude,

ok then how to write a condition code, please help me.

Willams,

yes, if file is not in sorting order, we need to get abend code, please let me know how to specify the key.

Thanks,

Regards,
Venky.

William Collins
Active Member
Posts: 732
Joined: Thu May 24, 2012 4:07 am

Post by William Collins » Sat Nov 10, 2012 11:20 pm

Set the key in the normal way. It will not abend, it will give an RC of 16.

DikDude
Moderator
Posts: 1001
Joined: Fri Jul 22, 2011 8:39 am
Location: usa

Post by DikDude » Sun Nov 11, 2012 5:13 am

we need to get abend code
You have been asked multiple times why . . . If you refuse to provide information requested, why should people try to help :?

And NO - it is NOT a business requirement and most likely does NOT support a business reqiuirement. Most likely it is just a disconnected communication.

You can have the sort issue a return code (as you have been told multiple times) and terminate processing based on this return code.
Last edited by DikDude on Mon Nov 12, 2012 1:25 am, edited 2 times in total.
Have a good one

William Collins
Active Member
Posts: 732
Joined: Thu May 24, 2012 4:07 am

Post by William Collins » Sun Nov 11, 2012 1:25 pm

Venky,

An "abend" is a "system abend" or a "user abend". Look up the terms and understand what they mean, ask, with an explanation of what you understand to that point, if you are unsure.

A JCL error is something wrong with the JCL, syntactically or in some cases logically, which will usually "flush" the job before it gets an opportunity to run (because it can't) or cancels the job once encountered (like duplicate dataset).

A return-code is a value that can be set by any program (if code is included to do so) and whose value can be tested using the Condition Code processing available in JCL. See the JCL manuals.

The only sensible way to arrange your process is to use the final one, the Return-Code with Condition-Code checking.

academyindia4

Topic deleted by Admin

Post by academyindia4 » Fri Jan 15, 2016 9:49 pm

<< Content deleted By Admin >>

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others