IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Sort an input file


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Nair_Vin

New User


Joined: 03 Sep 2015
Posts: 3
Location: india

PostPosted: Thu Sep 03, 2015 5:55 pm
Reply with quote

I have an input file as below:

Code:
AXW1;N/A;N/A;XXXXGDP ;06/20/15 01:25:29;06/20/15 01:38:47;N/A;JCLERR.
AXW3;N/A;N/A;SY572DQ ;06/20/15 03:28:41;06/20/15 03:31:29;N/A;U0002 .
AXW1;N/A;N/A;YYPRT1TR;06/20/15 07:30:07;06/20/15 09:35:35;N/A;S04E  .
BXW1;N/A;N/A;YYPRT1TR;06/20/15 09:49:22;06/20/15 09:49:23;N/A;S04E  .


What I want to sort this file based on column 63-68. If the error code is JCLERR then keep the line as same, if the error is U0002 then move the code from line 63-68 to 69-74 and if the error is SO4E then move it to 75-81. How can I do this?

Code'd
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Thu Sep 03, 2015 7:00 pm
Reply with quote

So you want to sort a dataset. Why not post your query in one of the sort sections of the forum? Which sort product do you use? On answer to that we can move the topic to the correct place.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Sep 03, 2015 7:34 pm
Reply with quote

Hopefully you are OK with the SORT bit.

Then you need to use OUTREC or OUTFIL, as both execute after SORT. Unless OUTFIL is needed, prefer OUTREC.

In the OUTREC you need two conditions, IFTHEN=(WHEN=(logicalexpression) to identify your different data (do nothing about the JCLERR, because you don't want to do anything with it).

Code:
  OUTREC  IFOUTLEN=81,
         IFTHEN=(WHEN=(63,6,CH,EQ,C'U0002'),
               OVERLAY=(69:63,6,63:6X)),
         IFTHEN=(WHEN=(63,6,CH,EQ,C'S04E'),
               OVERLAY=(75:63,6,63:6X))


I'm not sure why you want 81 bytes, as the final one will always be blank. If you only want the same size as your input, remove the IFOUTLEN, otherwise make it the value of the LRECL.

You can use BUILD instead of OVERLAY, and you probably don't have enough records to note that the OVERLAY when the input and output are the same size will be faster. It also gives you some practice in OVERLAYing a field you use in the same OVERLAY, so you have to do that last.

The BUILD would be something like (1,66,6X,63,6,80:X) for the first. Not that with BUILD, because you are copying from the input record, not overwriting it, there is no possibility of squishing a field you want to use, so the 6X affects the "current" record only, not the input.
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 577
Location: USA

PostPosted: Thu Sep 03, 2015 7:36 pm
Reply with quote

If I understood correctly, you don't want to sort the file. This is just a plain vanilla case of looking for a value in certain position and put it someplace else.

Please show your expected output with all relevant possibilities.

Thanks,
Back to top
View user's profile Send private message
RahulG31

Active User


Joined: 20 Dec 2014
Posts: 446
Location: USA

PostPosted: Thu Sep 03, 2015 9:00 pm
Reply with quote

Quote:
This is just a plain vanilla case of looking for a value in certain position and put it someplace else.

I agree with sqlcode1.

Nair_Vin,

Have you even tried searching for a solution on the web? Yes, I know, the answer is 'Why would I bother when I can get a solution straight away'.
May be you are in a hurry to leave office, go home at 6 pm and when you come back in the morning next day, the solution is ready waiting for you.
This seems like an excellent idea: Post your issues on the forum before you leave work and somebody else will solve them for you while you sleep.
Back to top
View user's profile Send private message
RahulG31

Active User


Joined: 20 Dec 2014
Posts: 446
Location: USA

PostPosted: Thu Sep 03, 2015 9:31 pm
Reply with quote

Not even asking you to read the manual BUT
Quote:
Have you even tried searching for a solution on the web?

If you are still learning there's no stopping you to go to web and see thousands of examples on what you intend to do.

AND
Quote:
This is NOT a beginner's forum


Beginners can go to: http://ibmmainframeforum.com/

Hope you understand.
Back to top
View user's profile Send private message
Nair_Vin

New User


Joined: 03 Sep 2015
Posts: 3
Location: india

PostPosted: Thu Sep 03, 2015 9:53 pm
Reply with quote

Thanks Rahul. I was not aware of that forum. I will surely use that platform for my further learning. Appreciate your help.
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Thu Sep 03, 2015 9:54 pm
Reply with quote

Sort is NOT JCL - nothing is JCL except JCL as described in the JCL Reference manual.

You may have SORT on your EXEC PGM= but that is just an alias for the real name which would be DFSORT for IBM's sort product or SYNCSORT for the other main sort product. You need to look at the messages on SYSOUT to determine which product you are using. Please clarify.
Back to top
View user's profile Send private message
Nair_Vin

New User


Joined: 03 Sep 2015
Posts: 3
Location: india

PostPosted: Thu Sep 03, 2015 10:04 pm
Reply with quote

@Nic Clouston - I am using DFSORT and I just tried the option which Bill Woodger provided and it worked fine. Thank you all for taking time to help me. Please mark this item as complete.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3051
Location: NYC,USA

PostPosted: Thu Sep 03, 2015 10:46 pm
Reply with quote

Quote:
Thanks Rahul. I was not aware of that forum. I will surely use that platform for my further learning. Appreciate your help.



Note: If you have more than two years of experience in Mainframe Programming, please register and use our Expert Forum

If your experience > 2 Years, then you should be fine <asking questions> here. But As Rahul said look around the web or this forum for similar requirements before posting.

Keep Learning.. icon_wink.gif
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 577
Location: USA

PostPosted: Thu Sep 03, 2015 10:56 pm
Reply with quote

Nair_Vin wrote:
Thank you Bill Woodger for your help.
@ sqlcode1 & RahulG31 - Its okay If you don't have mentality to help ours buts its better to keep quiet rather showing your frustration... It may be a 'plain vanilla' case for someone who knows how it works but it may not be the case for others who rarely work on JCL..I am still learning and thanks for your 'help'

Historically, I am normally not the one to show frustration but posts like this makes me want to do it. Read my post clearly again with an empty mind try to find out why i was asking questions. I was merely asking for clear requirement which you obviously didn't care to provide in the first post. Plain vanilla case because you mentioned wanting to SORT file in your original post which would have been an overkill if you don't need one. The fact that Bill's solution is working tells me this was plain vanilla.

Code:
<frustration on>
Asking right questions is really an art.
</frustration off>


Thanks,
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Sep 04, 2015 12:23 am
Reply with quote

Nair_Vin,

I have removed a couple of your posts. Please be more considerate to those who are trying to help. If you look at the number of posts those two users have made, and the assistance they have provided, you should be able to see that your comments were thoughtless and wrong.

For a beginner, the Beginner's Forum is the place to start.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts TRIM everything from input, output co... DFSORT/ICETOOL 1
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
Search our Forums:

Back to Top