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
 

 

Requesting to provide me DFSORT syntax.

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

New User


Joined: 11 Jan 2010
Posts: 13
Location: chennai/hyderabad

PostPosted: Thu Jun 02, 2011 11:12 am    Post subject: Requesting to provide me DFSORT syntax.
Reply with quote

Hi,

I have one question,If some gets some time please help..

1st Example:
I have an input file namely EMP-IN & output EMP-OUT which is (FB, LRECL=80) respectively

EMP-IN
----------------------------------------------------
ESUOHG ENAID
OTLA NELLA
----------------------------------------------------

I want the above Input as below output

EMP-OUT
-----------------------------------------------------
ALLEN ALTO
DIANE GHOUSE
-----------------------------------------------------

Condition :
Last letter of the input file is getting reserved to 1st letter in the output file..(i.e OTLA NELLA (input) to ALLEN ALTO(output). Similary till the end of the string..
Can we do this using DFSORT?

I am referring to the DFSORT material to findout.. Meanwhile if possible help me out..


Thank you so much for the help
Back to top
View user's profile Send private message

gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

PostPosted: Thu Jun 02, 2011 11:40 am    Post subject:
Reply with quote

Hi Raghu,

here is one way of doing this
Code:
//SORT0001 EXEC PGM=SORT                                               
//SORTIN   DD *                                                         
ESUOHG ENAID                                                           
OTLA NELLA                                                             
/*                                                                     
//SORTOUT  DD SYSOUT=*                                                 
//SYSOUT   DD SYSOUT=*                                                 
//SYSIN    DD *                                                         
  OPTION COPY                                                           
  INREC OVERLAY=(81:80,1,79,1,78,1,77,1,76,1,75,1,74,1,73,1,72,1,71,1, 
                    70,1,69,1,68,1,67,1,66,1,65,1,64,1,63,1,62,1,61,1, 
                    60,1,59,1,58,1,57,1,56,1,55,1,54,1,53,1,52,1,51,1, 
                    50,1,49,1,48,1,47,1,46,1,45,1,44,1,43,1,42,1,41,1, 
                    40,1,39,1,38,1,37,1,36,1,35,1,34,1,33,1,32,1,31,1, 
                    30,1,29,1,28,1,27,1,26,1,25,1,24,1,23,1,22,1,21,1, 
                    20,1,19,1,18,1,17,1,16,1,15,1,14,1,13,1,12,1,11,1, 
                    10,1,09,1,08,1,07,1,06,1,05,1,04,1,03,1,02,1,01,1) 
  OUTREC BUILD=(81,80,JFY=(SHIFT=LEFT))                                 
/*                                                                     


Gerry
Back to top
View user's profile Send private message
ragbose

New User


Joined: 11 Jan 2010
Posts: 13
Location: chennai/hyderabad

PostPosted: Thu Jun 02, 2011 1:58 pm    Post subject: Reply to: Requesting to provide me DFSORT syntax.
Reply with quote

Hi Greey,

Thank you very much.

The JCL provided by you is working very fine.. But I am sorry if my requirement is not clear to you..

If you see the input file
EMP-IN
----------------------------------------------------
ESUOHG ENAID
OTLA NELLA
----------------------------------------------------

And I wanted the output file as
-----------------------------
ALLEN ALTO - this was the last record in the input file
DIANE GHOUSE - First record of the input file
---------------------------

So The jcl shoudl reverse the letter as well as the Last record should come as 1st record in the output and next last record should be 2nd and so on till EOF.


Once again I am sorry if i am not clear with the explanation.

Thanks for spending time and helping us
Back to top
View user's profile Send private message
nigelosberry

New User


Joined: 06 Jan 2009
Posts: 88
Location: Ggn, IN

PostPosted: Thu Jun 02, 2011 3:01 pm    Post subject: Re: Requesting to provide me DFSORT syntax.
Reply with quote

Once you have done what gcicchet suggested you could write another SORT step in the job with something like:

Code:
INREC OVERLAY=(81:SEQNUM,8,ZD)
SORT FIELDS=(81,8,ZD,D)
OUTREC BUILD=(1,80)



The output dataset after this should have the records written in your desired order.
Back to top
View user's profile Send private message
Garry Carroll

Active Member


Joined: 08 May 2006
Posts: 990
Location: Dublin, Ireland / Edinburgh, Scotland

PostPosted: Thu Jun 02, 2011 4:29 pm    Post subject:
Reply with quote

Or even, in a single step as:
Code:
//SORT0001 EXEC PGM=SORT                                             
//SORTIN   DD *                                                     
ESUOHG ENAID                                                         
OTLA NELLA                                                           
/*                                                                   
//SORTOUT  DD SYSOUT=*                                               
//SYSOUT   DD SYSOUT=*                                               
//SYSIN    DD *                                                     
  INREC OVERLAY=(81:80,1,79,1,78,1,77,1,76,1,75,1,74,1,73,1,72,1,71,1
                    70,1,69,1,68,1,67,1,66,1,65,1,64,1,63,1,62,1,61,1
                    60,1,59,1,58,1,57,1,56,1,55,1,54,1,53,1,52,1,51,1
                    50,1,49,1,48,1,47,1,46,1,45,1,44,1,43,1,42,1,41,1
                    40,1,39,1,38,1,37,1,36,1,35,1,34,1,33,1,32,1,31,1
                    30,1,29,1,28,1,27,1,26,1,25,1,24,1,23,1,22,1,21,1
                    20,1,19,1,18,1,17,1,16,1,15,1,14,1,13,1,12,1,11,1
                    10,1,09,1,08,1,07,1,06,1,05,1,04,1,03,1,02,1,01,1
                    SEQNUM,8,ZD)             
  SORT FIELDS=(161,8,ZD,D)                                       
  OUTREC BUILD=(81,80,JFY=(SHIFT=LEFT))                             
/*                                                                   


Garry.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Thu Jun 02, 2011 10:03 pm    Post subject:
Reply with quote

Garry Carroll,

You are missing a comma at the end on your INREC statement. I would suggest using a BUILD rather than an overlay.

Code:

//SYSIN    DD *                                                       
  INREC BUILD=(80,1,79,1,78,1,77,1,76,1,75,1,74,1,73,1,72,1,71,1,     
               70,1,69,1,68,1,67,1,66,1,65,1,64,1,63,1,62,1,61,1,     
               60,1,59,1,58,1,57,1,56,1,55,1,54,1,53,1,52,1,51,1,     
               50,1,49,1,48,1,47,1,46,1,45,1,44,1,43,1,42,1,41,1,     
               40,1,39,1,38,1,37,1,36,1,35,1,34,1,33,1,32,1,31,1,     
               30,1,29,1,28,1,27,1,26,1,25,1,24,1,23,1,22,1,21,1,     
               20,1,19,1,18,1,17,1,16,1,15,1,14,1,13,1,12,1,11,1,     
               10,1,09,1,08,1,07,1,06,1,05,1,04,1,03,1,02,1,01,1,     
               SEQNUM,8,ZD)                                           
                                                                       
  SORT FIELDS=(81,8,ZD,D)                                             
  OUTREC BUILD=(1,80,JFY=(SHIFT=LEFT))                                 
//*
Back to top
View user's profile Send private message
ragbose

New User


Joined: 11 Jan 2010
Posts: 13
Location: chennai/hyderabad

PostPosted: Fri Jun 03, 2011 9:38 am    Post subject: Reply to: Requesting to provide me DFSORT syntax.
Reply with quote

Hi,


Thanks a lot,
I have one doubt/question..Why do we give (SORT FIELDS=(81,8,ZD,D)) 81 position as the file is having only LRECL as 80? Any reason? always I seen them in Overlay as well INREC OVERLAY=(81:SEQNUM,8,ZD))
Sorry if this question is silly.. bt wanted to know..

Thanks Skolusu.. Even i corrected when i use that JCL given by Greey,

I have found one more way to copy the records, Hope it helps some one

JCL Used:
//SORT001 EXEC PGM=SORT
//SORTIN DD DSN=INPUT-FILE,DISP=SHR
//SORTOUT DD DSN=&&TEMP,DISP=(,PASS)
//SYSOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC OVERLAY=(81:80,1,79,1,78,1,77,1,76,1,75,1,74,1,73,1,72,1,71,1,
70,1,69,1,68,1,67,1,66,1,65,1,64,1,63,1,62,1,61,1,
60,1,59,1,58,1,57,1,56,1,55,1,54,1,53,1,52,1,51,1,
50,1,49,1,48,1,47,1,46,1,45,1,44,1,43,1,42,1,41,1,
40,1,39,1,38,1,37,1,36,1,35,1,34,1,33,1,32,1,31,1,
30,1,29,1,28,1,27,1,26,1,25,1,24,1,23,1,22,1,21,1,
20,1,19,1,18,1,17,1,16,1,15,1,14,1,13,1,12,1,11,1,
10,1,09,1,08,1,07,1,06,1,05,1,04,1,03,1,02,1,01,1)
OUTREC BUILD=(81,80,JFY=(SHIFT=LEFT))
/*
//STEP002 EXEC PGM=FILEAID
//DD01 DD DSN=&&TEMP,DISP=SHR
//DD01O DD SYSOUT=*
//SYSIN DD *
$$DD01 COPYBACK OUT=2
//SYSPRINT DD SYSOUT=*


Thanks every one... once again.. you are really helping us!!


EMP-IN
----------------------------------------------------
ESUOHG ENAID
OTLA NELLA
----------------------------------------------------

EMP-OUT
-----------------------------
ALLEN ALTO
DIANE GHOUSE
---------------------------
Back to top
View user's profile Send private message
nigelosberry

New User


Joined: 06 Jan 2009
Posts: 88
Location: Ggn, IN

PostPosted: Fri Jun 03, 2011 10:07 am    Post subject: Re: Reply to: Requesting to provide me DFSORT syntax.
Reply with quote

ragbose wrote:
Why do we give (SORT FIELDS=(81,8,ZD,D)) 81 position as the file is having only LRECL as 80? Any reason? always I seen them in Overlay as well INREC OVERLAY=(81:SEQNUM,8,ZD))


This means that the sort utility writes an 8 byte sequence number at position 81 of the output record. Your file has lrecl=80 but sort workspace has more.

This 8 byte sequence number is nothing but a number nnnnnnnn in Zoned Decimal format. Once sort has added sequence number to all the records, this sequence number can then be used for sorting the dataset in an order based on this very sequence number.

Try OVERLAY=(71:SEQNUM,8,ZD) with the same file and see what's the output. You will get a better understanding of this.
Back to top
View user's profile Send private message
nigelosberry

New User


Joined: 06 Jan 2009
Posts: 88
Location: Ggn, IN

PostPosted: Fri Jun 03, 2011 11:06 am    Post subject: Re: Reply to: Requesting to provide me DFSORT syntax.
Reply with quote

ragbose wrote:

Code:
//STEP002  EXEC PGM=FILEAID         
//DD01     DD  DSN=&&TEMP,DISP=SHR   
//DD01O    DD  SYSOUT=*             
//SYSIN    DD  *                     
$$DD01 COPYBACK OUT=2               
//SYSPRINT DD  SYSOUT=*   



This is FileAid called from batch. Depends on whether an installation has File-Aid.

Why to break a simple task in 2 steps and both the steps have different utilities running!! As Garry said, the overall thing can be done in a single step. And I feel that will be better from a maintenance point of view.
Back to top
View user's profile Send private message
Garry Carroll

Active Member


Joined: 08 May 2006
Posts: 990
Location: Dublin, Ireland / Edinburgh, Scotland

PostPosted: Fri Jun 03, 2011 11:40 am    Post subject:
Reply with quote

Kolusu wrote:
Quote:
Garry Carroll,

You are missing a comma at the end on your INREC statement. I would suggest using a BUILD rather than an overlay.



My bad - cut & paste error. I take your point about BUILD rather than OVERLAY. thanks.

Garry.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Fri Jun 03, 2011 10:42 pm    Post subject: Re: Reply to: Requesting to provide me DFSORT syntax.
Reply with quote

ragbose wrote:

I have found one more way to copy the records, Hope it helps some one


I don't think it is going to be of any help to anyone when your file-aid control cards are limiting the output to just 2 records. what happens if your input has more than 2 records like this? Are you going to change the control cards every time you have variable number of records?
Code:

//SORTIN   DD *             
ESUOHG ENAID               
OTLA NELLA                 
ESOBGAR                     
REGEAY KNARF               
TROSFD                     
MBI                         


On the other hand I don't see a need/reason to use another utility to read the file once again when you can do everything you want in a single pass of data.
Back to top
View user's profile Send private message
ragbose

New User


Joined: 11 Jan 2010
Posts: 13
Location: chennai/hyderabad

PostPosted: Sat Jun 04, 2011 12:11 pm    Post subject: Reply to: Requesting to provide me DFSORT syntax.
Reply with quote

Hi All,

Ya Skolusu You are correct..I checked the forum once after I got the other way to copy the record from back... So I posted the solution I used to satisfy the requirement and later Once I see your solution I incorporated according to you..

Sorry for the confusion.

Thanks each and every one for helping.
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 How to get the remainder and quotient... vnktrrd DFSORT/ICETOOL 2 Mon Oct 31, 2016 10:59 am
No new posts Change date (DD/MM/YY) in 2nd record ... uday kiran DFSORT/ICETOOL 12 Wed Sep 07, 2016 10:57 pm
No new posts DFSORT sorting only specific records akodakka DFSORT/ICETOOL 4 Thu Aug 04, 2016 11:24 am
No new posts Symbolic Parameters in SYSIN DD state... madishpa DFSORT/ICETOOL 3 Mon Jun 27, 2016 6:23 pm
No new posts Syntax for running batch history repo... polymathtarun CA Products 1 Tue Jun 21, 2016 1:51 pm


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