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 an input file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Sort an input file
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: 1715
Location: UK

PostPosted: Thu Sep 03, 2015 7:00 pm    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7236

PostPosted: Thu Sep 03, 2015 7:34 pm    Post subject: Reply to: Sort an input file
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: 578
Location: USA

PostPosted: Thu Sep 03, 2015 7:36 pm    Post subject:
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: 331
Location: USA

PostPosted: Thu Sep 03, 2015 9:00 pm    Post subject: Reply to: Sort an input file
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: 331
Location: USA

PostPosted: Thu Sep 03, 2015 9:31 pm    Post subject: Reply to: Sort an input file
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    Post subject:
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: 1715
Location: UK

PostPosted: Thu Sep 03, 2015 9:54 pm    Post subject:
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    Post subject:
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

Senior Member


Joined: 21 Sep 2010
Posts: 1610
Location: NY,USA

PostPosted: Thu Sep 03, 2015 10:46 pm    Post subject:
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: 578
Location: USA

PostPosted: Thu Sep 03, 2015 10:56 pm    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7236

PostPosted: Fri Sep 04, 2015 12:23 am    Post subject: Reply to: Sort an input file
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    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 Performing arithmetic on input field zh_lad DFSORT/ICETOOL 24 Tue Dec 06, 2016 8:04 pm
No new posts High CPU consumption Job using IAM fi... aswinir JCL & VSAM 8 Thu Dec 01, 2016 8:28 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm


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