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

Is it possible using DFSORT?


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

New User


Joined: 03 May 2005
Posts: 1

PostPosted: Tue May 03, 2005 2:48 pm
Reply with quote

Hi,
I have an input file with the first line as header line and remaining records are data records. I have to sort the data records and the o/p should have the header line followed by the sorted data records. can we do it using DFSORT?
Please advice
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Tue May 03, 2005 9:03 pm
Reply with quote

You can do this in one pass with DFSORT using DFSORT's new IFTHEN and OVERLAY functions available with z/OS DFSORT V1R5 PTF UQ95214 or DFSORT R14 PTF UQ95213 (Dec, 2004). If you don't have the Dec, 2004 PTF installed, ask your System Programmer to install it (it's free). Here's the DFSORT job. I assumed your input file has RECFM=FB and LRECL=80 and I made up some data. But you can change the job appropriately for other attributes and data.

Code:

//S1    EXEC  PGM=ICEMAN
//SORTDIAG DD DUMMY
//SYSOUT    DD  SYSOUT=*
//SYSUDUMP  DD  SYSOUT=*
//SORTIN DD *
THIS IS THE HEADER RECORD
DATA 05
DATA 03
DATA 02
DATA 04
DATA 01
/*
//SORTOUT  DD SYSOUT=*
//SYSIN    DD    *
* Reformat record 1 (header to):
* |record|0|seqnum|
* Reformat record 2-n (data) to:
* |record|1|seqnum|
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:C'1',82:SEQNUM,8,ZD)),
        IFTHEN=(WHEN=(82,8,ZD,EQ,+1),OVERLAY=(81:C'0'))
* Sort on 0 or 1 and then the key.  0 for the header record
* and 1 for the data records keeps the header first.
  SORT FIELDS=(81,1,CH,A,6,2,CH,A)
* Remove 0 or 1 and seqnum.
  OUTREC FIELDS=(1,80)
/*


SORTOUT has:

Code:

THIS IS THE HEADER RECORD
DATA 01
DATA 02
DATA 03
DATA 04
DATA 05


If you need more specific help on this, you need to tell me the RECFM and LRECL of your input file and show me an example of the input records with the relevent fields.
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1448
Location: Chicago, IL

PostPosted: Fri May 13, 2005 9:29 pm
Reply with quote

Hi Frank,

I tried your code : & got this error in SYSOUT

Code:
ICE805I 1 JOBNAME: ..... , STEPNAME: S020                                   
ICE802I 0 BLOCKSET TECHNIQUE IN CONTROL                                   
ICE104A 0 INVALID INREC OR OUTREC STATEMENT OPERAND         
ICE005A 0 STATEMENT DEFINER ERROR                                             
ICE012A 2 MISSING FIELDS OPERAND DEFINER                                     
ICE143I 0 BLOCKSET     SORT  TECHNIQUE SELECTED                           
ICE000I 1 - CONTROL STATEMENTS FOR 5740-SM1, DFSORT REL 14.0 - 10:52 ON FRI MAY
       INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:C'1',82:SEQNUM,8,ZD)),
             $                                                             
ICE104A 0 INVALID INREC OR OUTREC STATEMENT OPERAND               
                 IFTHEN=(WHEN=(82,8,ZD,EQ,+1),OVERLAY=(81:C'0'))         
                 $                                                             
ICE005A 0 STATEMENT DEFINER ERROR                                             
           SORT FIELDS=(81,1,CH,A,6,2,CH,A)                                   
           OUTREC FIELDS=(1,80)                                               
ICE012A 2 MISSING FIELDS OPERAND DEFINER                                     
ICE052I 3 END OF DFSORT       


Is this because of version problem of DFSORT I m using.
In above Error I saw it is DFSORT REL 14.0, was that U have written this code for ?

Or there is any other problem,

Thanks & Reagrds,

Priyesh.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Fri May 13, 2005 10:34 pm
Reply with quote

Priyesh,

As I said, you need DFSORT R14 PTF UQ95213 (Dec, 2004) to use DFSORT's new IFTHEN function. The error message indicates you don't have that PTF installed. Ask your System Programmer to install the PTF (it's free). For complete details on all of the new DFSORT and ICETOOL functions available with the Dec, 2004 PTF, see:

Use [URL] BBCode for External Links
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1448
Location: Chicago, IL

PostPosted: Fri May 13, 2005 10:40 pm
Reply with quote

Thanks Frank,

I hope it didn't bother u to answer such silly queries. icon_lol.gif

Regards,

Priyesh.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Fri May 13, 2005 11:43 pm
Reply with quote

Priyesh,

I don't consider such queries "silly". I'm happy to answer questions of any kind on DFSORT and DFSORT's ICETOOL.
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 Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts DFsort help with SUM() DFSORT/ICETOOL 12
No new posts DFSORT - VB file RDW getting overridden DFSORT/ICETOOL 3
Search our Forums:

Back to Top