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

DFSORT Sequence#


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

New User


Joined: 09 Feb 2009
Posts: 57
Location: India

PostPosted: Sat Jul 31, 2010 4:21 pm
Reply with quote

Hi,

I have a flat file mentioned below:

Code:

----+---10----+---20----+---30----+---40
A10000 AAAA
B20000 ASDA
A12000 25325
R25411 36365
S25454 23655


Now, the out required should contain only the 1st six columns of the input file, along with Sequence# in 1st column of the output file. The format of output file should be:
Code:

----+---10----+---20----+---30----+---40
1A10000
2B20000
3A12000
4R25411
5S25454


I had tried using SORT, but only succeeded in get the output except Sequence#. The Sort Card used is:
Code:

//STPSORT EXEC PGM=SORT
//SORTIN   DD  DSN=INPUT.FILE,DISP=SHR
//SORTOUT DD DSN=OUTPUT.FILE1,
//           DISP=(NEW,CATLG,DELETE),
//           DCB=*.SORTIN
//SYSIN DD *
   SORT FIELDS = COPY
   OUTFIL OUTREC=(1:1X'40',2:1,6,8:5X'40')
/*


I tried a no. of things, but didn't succeed in getting the Sequence#. Please guide.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Sat Jul 31, 2010 5:38 pm
Reply with quote

You need SEQNUM parameter of DFSort. I'm not connected to mainframes, however, please try this untested code:
Code:

//SYSIN DD *
  SORT FIELDS=COPY
  OUTREC FIELDS=(1:SEQNUM,1,ZD,2:1,6,40:X)
/*
Back to top
View user's profile Send private message
ChowHan

New User


Joined: 16 Oct 2009
Posts: 15
Location: India

PostPosted: Mon Aug 02, 2010 3:58 am
Reply with quote

What happens when the 10th record is reached ? I guess i will try this one out myself.
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Mon Aug 02, 2010 5:57 am
Reply with quote

Hi,


Quote:
What happens when the 10th record is reached ? I guess i will try this one out myself.


You will need to decide how many bytes yu are going to use for the SEQNUM.

Also if the output file is 40 bytes long, you need to use this
Code:
  SORT FIELDS=COPY                       
  OUTREC FIELDS=(SEQNUM,1,ZD,1,6,40:X)   


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

New User


Joined: 09 Feb 2009
Posts: 57
Location: India

PostPosted: Mon Aug 02, 2010 11:27 pm
Reply with quote

This was for a test purpose. Actual length of Sequence# is 8 bytes.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Tue Aug 03, 2010 3:57 pm
Reply with quote

Ok, any other hiding fact?

For sequence# of length 8
Code:
//SYSIN DD *   
  SORT FIELDS=COPY                           
  OUTREC FIELDS=(1:SEQNUM,8,ZD,9:1,6,40:X)   
/*                                           
Back to top
View user's profile Send private message
prem_ibm

New User


Joined: 15 Sep 2007
Posts: 31
Location: Chennai

PostPosted: Tue Aug 03, 2010 6:11 pm
Reply with quote

Hi All,,

Need small clarity........suppose file lentgh is fixed as below

LRECL=40.

1)if i want to add sequence number(1 'minimum' to 8'maximum' digit) at the end of file OR at begining,...it will allow or thorugh error due to fixed length i.e 80.

2)If allow then what about our records which present on those columns....

i am very sorry if it looks minor doubt...but need proper answer.
Thank
Prem.....
Back to top
View user's profile Send private message
Garry Carroll

Senior Member


Joined: 08 May 2006
Posts: 1193
Location: Dublin, Ireland

PostPosted: Tue Aug 03, 2010 6:53 pm
Reply with quote

If you start with RECFM=FB,LRECL=40 and pre-pend or append 8 bytes, DFSORT will give you an output file RECFM=FB,LRECL=48. If you want to have LRECL=80 output, put a blank in position 80 and DFSORT will oblige. If you put your SEQNUM starting in position 73, you would also get LRECL=80.

Garry.
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 Aug 03, 2010 11:42 pm
Reply with quote

Quote:
i am very sorry if it looks minor doubt...but need proper answer.


To get a proper answer, you must ask your question clearly, which you haven't done.

What exactly is it you want to do? What is the RECFM and LRECL of the input file? What do you want for the RECFM and LRECL of the output file? What exactly do you want the output file to look like? Do you want to create a new output file, or use an existing file for output?

Quote:
2)If allow then what about our records which present on those columns....


Huh? I have no idea what this means.
Back to top
View user's profile Send private message
smijoss

Active User


Joined: 30 Aug 2007
Posts: 114
Location: pune

PostPosted: Wed Aug 04, 2010 4:06 pm
Reply with quote

"If allow then what about our records which present on those columns...." -

Obviously you records will get shifted to right if you add seqnum to left.


if you want to keep the output file length fixed at 40, adjust you build parameter.

DFSORT will not THROW error. if you dont adjsust the Build in outrec it will change your output LRECL.
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 Cobol program with sequence number ra... COBOL Programming 5
Search our Forums:

Back to Top