sort card to create a file matching the record structure?

In this Mainframe Forum - You can post your queries on DFSORT, ICETOOL , SyncSort & JCL Utilities

Moderators: Frank Yaeger, Moderator Group

Post Reply
sganesh_85
Member
Posts: 14
Joined: Thu Jun 16, 2011 10:18 am

sort card to create a file matching the record structure?

Post by sganesh_85 » Mon Jul 04, 2011 2:21 pm

Hi

i need a sort card to strip a space or "?" from a record in file.
the file is a fixed length file.

the structure of the record in file would be

ACC-ID PIC 9(3).
CREATED-BY PIC X(8).
CREATION-DATE PIC X(26).
DESCRIPTION PIC X(15).
UPDATED-BY PIC X(8).
LATITUDE PIC 9(3)V9(8).

and in file the record in the file looks like

" 1 POSTALCD2010-10-01-08.20.45.222819 EMAILCC POSTALCD -33.7891234 "
" ?POSTALCD ?EMAILCC POSTALCD -33.7891234 "

These are the 2 sample records.

In these records when file record is cmpared with record structure, i found one extra space or "?" is added in end of some fields (which are not specified as not null in declaration).

my requirement is i need to create a file with actual record structure.

i tried with sort card by specfying the length and extracting it to a new file.
But in some files the record length is 1072 and the record structure has nearly 72 fields of various datatypes.

Is there any way to use SORT to create a file with the actual record length?

Please help!!
Thanks,
Ganesh.

User avatar
Frank Yaeger
Moderator
Posts: 812
Joined: Sat Feb 18, 2006 5:45 am
Location: San Jose, CA
Contact:

Post by Frank Yaeger » Wed Jul 06, 2011 12:41 am

Sort doesn't know where or what your fields are. You have to tell it. Sort can't read a COBOL record structure and figure out what it means. However, sort does have equivalents of most of the COBOL formats as shown at:

http://publibz.boulder.ibm.com/cgi-bin/ ... 0630155256

Sort doesn't know what's in your fields or what should be in your fields. You have to tell it.

Your description does not give any "rules" for "fixing" the data so how do you expect anyone to give you a programmatic solution?

If you can explain clearly the rules you want to use for getting from input to output, then I might be able to show you how to do what you want with DFSORT.

But as stated, your description doesn't give much useful information.
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort

sganesh_85
Member
Posts: 14
Joined: Thu Jun 16, 2011 10:18 am

Post by sganesh_85 » Wed Jul 06, 2011 10:32 am

Hi Frank,
Thanks for the reply!!
my requirement is , i need a output with a record length of
But my input file contains a record of length 75.

input record " 1 POSTALCD2010-10-01-08.20.45.222819 EMAILCC POSTALCD -33.7891234 "

input file record is a combination of 6 fields.
field 1 -- 04
field 2 -- 08
field 3 -- 27
field 4 -- 15
field 5 -- 09
field 6 -- 12

record starts from position 1.
recfm FB

but my output record should have the below field definition
field 1 -- 03
field 2 -- 08
field 3 -- 26
field 4 -- 15
field 5 -- 08
field 6 -- 11

output record length should be 71 starting from position 1

Expected output record
" 1POSTALCD2010-10-01-08.20.45.222819EMAILCC POSTALCD -33.7891234"

Please help!!
Thanks,
Ganesh.

User avatar
Frank Yaeger
Moderator
Posts: 812
Joined: Sat Feb 18, 2006 5:45 am
Location: San Jose, CA
Contact:

Post by Frank Yaeger » Thu Jul 07, 2011 1:42 am

If you want to truncate one byte on the right from fields 1, 3, 5 and 6, you can use these DFSORT statements:

Code: Select all

  OPTION COPY                                        
  INREC BUILD=(1,3,5,8,13,26,40,15,55,8,64,11)       
However, I'm guessing there's more to it than that you aren't telling us about and you'll come back and say "that didn't work for this other input record variation" which doesn't fit the same pattern as the one record you showed.

But that's the best I can do based on what you've told me so far.
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others