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
 

 

DFSORT Sequence#

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: DFSORT Sequence#
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

Senior Member


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

PostPosted: Sat Jul 31, 2010 5:38 pm    Post subject:
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    Post subject:
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: 1703
Location: Australia

PostPosted: Mon Aug 02, 2010 5:57 am    Post subject:
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    Post subject:
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

Senior Member


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

PostPosted: Tue Aug 03, 2010 3:57 pm    Post subject:
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    Post subject: Reply to: DFSORT Sequence#
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

Active Member


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

PostPosted: Tue Aug 03, 2010 6:53 pm    Post subject:
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 Moderator


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

PostPosted: Tue Aug 03, 2010 11:42 pm    Post subject:
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    Post subject:
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    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 DFSORT MUL FIELDS tspr52 DFSORT/ICETOOL 16 Fri Mar 03, 2017 11:53 pm
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 Sequence number add in SORT pshongal SYNCSORT 3 Fri Sep 02, 2016 3:32 pm
No new posts DFSORT sorting only specific records akodakka DFSORT/ICETOOL 4 Thu Aug 04, 2016 11:24 am


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