Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref

Author Message
vk0022789

New User

Joined: 24 Sep 2008
Posts: 15

 Posted: Wed Oct 01, 2008 12:06 pm    Post subject: SORT JCL for swapping the values How to write the SORT jcl for swapping the values? The conditions are as given below Consider ABCXYZ is a 6 bytes numerical values If first 3 positions do not contain valid ABC then swap ABC and XYZ, ABC should come to 4-6 position and XYZ should come to 1-3 position B. For M1 region if ABC-XYZ is 9130055 or 913365, no swap is required, but Swap XYZ and ABC if we have 055-913 or 365-913 (Swap combination). C. If ABC is not having the valid values, but XYZ has one of valid ABC values, swap XYZ and ABC. How to write the SORT jcl for swapping the values? Please let me know. Thanks

Escapa

Senior Member

Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

Posted: Wed Oct 01, 2008 12:12 pm    Post subject:

 Quote: If first 3 positions do not contain valid ABC then swap ABC and XYZ,

On what basis you decide ABC is valid or not?
 Quote: For M1 region if ABC-XYZ is 9130055 or 913365, no swap is required,

What do you mean by M1 region here?

Can you post sample input and desired output example?
vk0022789

New User

Joined: 24 Sep 2008
Posts: 15

 Posted: Wed Oct 01, 2008 12:19 pm    Post subject: Sample Input :314629 Require Output :629314 No need to care about the region..I am giving just example for M1 region
enrico-sorichetti

Global Moderator

Joined: 14 Mar 2007
Posts: 10396
Location: italy

 Posted: Wed Oct 01, 2008 12:23 pm    Post subject: Reply to: SORT JCL for swapping the values when posting, avoid jargon/terms related only to Your organization/shop it makes people willing to help to do a double work of interpretation ... of the problem to be solved ... of the terminology we do not care if the three chars are a region code or the size of the left shoe just that You have to swap them ( the left shoe with the right shoe )
vk0022789

New User

Joined: 24 Sep 2008
Posts: 15

 Posted: Wed Oct 01, 2008 12:29 pm    Post subject: sorry,i am not getting ...can you pls explain? our requirement is to swap the digits as follows Sample Input :314629 Require Output :629314
enrico-sorichetti

Global Moderator

Joined: 14 Mar 2007
Posts: 10396
Location: italy

Posted: Wed Oct 01, 2008 12:41 pm    Post subject: Reply to: SORT JCL for swapping the values

 Quote: B. For M1 region if ABC-XYZ is 9130055 or 913365, no swap is required,

the suggestion is to keep things simple ,
use terms which do not need further explanation
do not post irrelevant info they just are disturbing noises
and imply often non exixtent or imaginary constraints
and lead to counter questions like...
in the case of the quoted sentence

what if there are other regions ( M2, M3, .... )

this post is an explanation of my previous remark, no need to reply
Escapa

Senior Member

Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

Posted: Wed Oct 01, 2008 2:46 pm    Post subject:

Hi vk0022789,
Still you haven't answered my question.. On what basis you are deciding whether it is valid for swap or not (swap is to be done or not)??
 Quote: our requirement is to swap the digits as follows Sample Input :314629 Require Output :629314

This you can do as
OUTREC FIELDS=(1:4,3,4:1,3)

For any DFSORT documentation click
http://www-304.ibm.com/systems/support/storage/software/sort/mvs/srtmpub.html
Frank Yaeger

DFSORT Moderator

Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

Posted: Wed Oct 01, 2008 10:23 pm    Post subject:

vk0022789,

You need to do a better job of explaining the "rules" for what you want to do. You haven't given any rules we can use for determining whether to swap or not. You need to tell us exactly how to determine whether to swap or not.

 Quote: If first 3 positions do not contain valid ABC then swap ABC and XYZ

does not help because we don't know what constitutes a valid ABC value.

Are you considering a particular range of values like 001-365 to be valid or is it something else? Be specific.
vk0022789

New User

Joined: 24 Sep 2008
Posts: 15

 Posted: Fri Oct 03, 2008 3:20 pm    Post subject: We want to swap first 3 bytes with 3 bytes starting from 4 position till 3 bytes. and values present in last 3 bytes should come to 1-3 bytes. Which Iam clearifying by below example. My input is 457345, here it is 6 bytes number, I want output as 345457 using swap command in sort jcl.
HappySrinu

Active User

Joined: 22 Jan 2008
Posts: 195
Location: India

 Posted: Fri Oct 03, 2008 3:46 pm    Post subject: Reply to: SORT JCL for swapping the values Hello VK... we always get better attention and much better solutions when we are clear with our examples. it would be great if you provide an exmaple like.. in flat file . 123456 234567 567889 o/p 456123 567234 889567 and put any conditions if you think required. then you do definately get excellent solutions by experts this group.
vk0022789

New User

Joined: 24 Sep 2008
Posts: 15

 Posted: Fri Oct 03, 2008 4:02 pm    Post subject: Reply to: SORT JCL for swapping the values Hi Srini,Thanks for your suggestions. I am beginner for this system. So conditions are not required for swapping the values.
Frank Yaeger

DFSORT Moderator

Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

Posted: Fri Oct 03, 2008 10:11 pm    Post subject:

 Quote: So conditions are not required for swapping the values.

This is NOT what you said before.

If the input file has RECFM=FB and LRECL=6, then the DFSORT job would be:

 Code: /S1 EXEC PGM=ICEMAN /SYSOUT DD SYSOUT=* /SORTIN DD DSN=...  input file (FB/6) /SORTOUT DD DSN=...  output file (FB/6) /SYSIN DD *  OPTION COPY  INREC BUILD=(4,3,1,3) /*

If the RECFM is not FB or the LRECL is not 6, then you need to tell me the RECFM and LRECL and also indicate if there is other data you want to keep as is after the 6 bytes you want to swap.

If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:

www.ibm.com/servers/storage/support/software/sort/mvs/srtmpub.html
 All times are GMT + 6 Hours
 Page 1 of 1

Search our Forum:

 Topic Author Forum Replies Posted Similar Topics attchmvs from rexx subroutine that re... harisukumaran CLIST & REXX 1 Fri Jan 19, 2018 5:29 am SORT BUT RETAIN HIGHEST VALUE ON NON-... leondan22 DFSORT/ICETOOL 2 Thu Dec 14, 2017 8:13 pm Extract record for change in combinat... Trinadh DFSORT/ICETOOL 6 Thu Nov 23, 2017 3:32 pm JOINKEYS Paired and Unpaired Sort on ... MFwhiz DFSORT/ICETOOL 7 Tue Nov 07, 2017 2:46 am Extend the decimal values in DIVISION Balaryan DFSORT/ICETOOL 3 Thu Oct 05, 2017 4:05 pm

 © 2003-2017 IBM MAINFRAME Software Support Division
 Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us