View previous topic :: View next topic
|
Author |
Message |
vk0022789
New User
Joined: 24 Sep 2008 Posts: 15 Location: hyderabad
|
|
|
|
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 |
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
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 |
|
|
vk0022789
New User
Joined: 24 Sep 2008 Posts: 15 Location: hyderabad
|
|
|
|
Sample Input :314629
Require Output :629314
No need to care about the region..I am giving just example for M1 region |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
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 |
|
|
vk0022789
New User
Joined: 24 Sep 2008 Posts: 15 Location: hyderabad
|
|
|
|
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 |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
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 |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
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
www-304.ibm.com/systems/support/storage/software/sort/mvs/srtmpub.html |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
|
vk0022789
New User
Joined: 24 Sep 2008 Posts: 15 Location: hyderabad
|
|
|
|
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 |
|
|
HappySrinu
Active User
Joined: 22 Jan 2008 Posts: 194 Location: India
|
|
|
|
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 |
|
|
vk0022789
New User
Joined: 24 Sep 2008 Posts: 15 Location: hyderabad
|
|
|
|
Hi Srini,Thanks for your suggestions.
I am beginner for this system.
So conditions are not required for swapping the values. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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:
Use [URL] BBCode for External Links |
|
Back to top |
|
|
|