Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

SORT JCL for swapping the values

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
vk0022789

New User


Joined: 24 Sep 2008
Posts: 15
Location: hyderabad

PostPosted: Wed Oct 01, 2008 12:06 pm    Post subject: SORT JCL for swapping the values
Reply with quote

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 icon_smile.gif
Back to top
View user's profile Send private message

Escapa

Senior Member


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

PostPosted: Wed Oct 01, 2008 12:12 pm    Post subject:
Reply with quote

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?
Back to top
View user's profile Send private message
vk0022789

New User


Joined: 24 Sep 2008
Posts: 15
Location: hyderabad

PostPosted: Wed Oct 01, 2008 12:19 pm    Post subject:
Reply with quote

Sample Input :314629

Require Output :629314

No need to care about the region..I am giving just example for M1 region
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10256
Location: italy

PostPosted: Wed Oct 01, 2008 12:23 pm    Post subject: Reply to: SORT JCL for swapping the values
Reply with quote

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 )
Back to top
View user's profile Send private message
vk0022789

New User


Joined: 24 Sep 2008
Posts: 15
Location: hyderabad

PostPosted: Wed Oct 01, 2008 12:29 pm    Post subject:
Reply with quote

sorry,i am not getting ...can you pls explain?

our requirement is to swap the digits as follows

Sample Input :314629

Require Output :629314
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10256
Location: italy

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

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
Back to top
View user's profile Send private message
Escapa

Senior Member


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

PostPosted: Wed Oct 01, 2008 2:46 pm    Post subject:
Reply with quote

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
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


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

PostPosted: Wed Oct 01, 2008 10:23 pm    Post subject:
Reply with quote

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.
Back to top
View user's profile Send private message
vk0022789

New User


Joined: 24 Sep 2008
Posts: 15
Location: hyderabad

PostPosted: Fri Oct 03, 2008 3:20 pm    Post subject:
Reply with quote

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.
Back to top
View user's profile Send private message
HappySrinu

Active User


Joined: 22 Jan 2008
Posts: 195
Location: India

PostPosted: Fri Oct 03, 2008 3:46 pm    Post subject: Reply to: SORT JCL for swapping the values
Reply with quote

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.
Back to top
View user's profile Send private message
vk0022789

New User


Joined: 24 Sep 2008
Posts: 15
Location: hyderabad

PostPosted: Fri Oct 03, 2008 4:02 pm    Post subject: Reply to: SORT JCL for swapping the values
Reply with quote

Hi Srini,Thanks for your suggestions.

I am beginner for this system.

So conditions are not required for swapping the values.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


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

PostPosted: Fri Oct 03, 2008 10:11 pm    Post subject:
Reply with quote

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
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 -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Sorting of hex values Saurabh_mi DFSORT/ICETOOL 11 Thu May 25, 2017 3:49 pm
No new posts How to change 'K' or 'M' use Sort vice_versa DFSORT/ICETOOL 5 Thu May 18, 2017 7:11 am
No new posts Replace values in the input data Vikas Maharnawar DFSORT/ICETOOL 10 Thu May 11, 2017 2:18 pm
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
This topic is locked: you cannot edit posts or make replies. SORT trick needed bshkris SYNCSORT 6 Tue May 02, 2017 4:35 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us