Page 1 of 3

Detail record sorting

PostPosted: Fri Feb 17, 2012 2:18 pm
by purva
Hi,

I have one sequential file (LRECL=80) with the below record structure:

HH -------> Header Record
AS,Empid1,H,N,current date,22:00,06:00-----> Detail record
JR,W,22:00,05:00,D008,S9518 ------> All JR records are part of the AS record.
JR,L1,05:00,05:30,D008,S9518
JR,W,05:30,06:00,D008,S9518
AS,Empid2,H,N,Previous date,22:00,06:00-----> Detail record
JR,W,22:00,05:00,D008,S9518 ------> All JR records are part of the AS record.
JR,L1,05:00,05:30,D008,S9518
JR,W,05:30,06:00,D008,S9518
TT ----------> Trailer record

The requirement is to sort the only AS records in detail record in ascending order by Empid & current date.
The file is currently having records in random order.
Emp id position is position is AS record is 5, length 7
Date filed position 13, length 8.

Appreciate your help!

Thanks,
Purva,

Re: Detail record sorting

PostPosted: Fri Feb 17, 2012 2:20 pm
by purva
Forgot to mention that the output file should have the header & trailer as it is. And the format should be like the existing file but only in ascending order of AS record.

Appreciate quick help for this.

Re: Detail record sorting

PostPosted: Fri Feb 17, 2012 2:25 pm
by Nik22Dec
It is difficult to understand your input file. Would be great if you can put it in between Code tags & also provide us with the sample output.

Re: Detail record sorting

PostPosted: Fri Feb 17, 2012 2:31 pm
by purva
Hi Nik,

Please find the the input file in a simple way:

HH -------> Header Record

AS,Empid1,H,N,current date -----> Detail record
JR,W,field1 ------> All JR records are part of the AS record.
JR,W,field2
JR,W,field3
AS,Empid2,H,N,previous date -----> Detail record
JR,W,field1 ------> All JR records are part of the AS record.
JR,W,field2
JR,W,field3
JR,W,field4
TT ----------> Trailer record


Let me know if you are able to understand now.

Re: Detail record sorting

PostPosted: Fri Feb 17, 2012 2:40 pm
by enrico-sorichetti
would it be so difficult to post the data using the code tags ? :evil:
it will preserve the alignment making helping You a pleasure instead of a pain in the ***

here is a <record> with the code tags
123456789012345678901234567890
a         b         c

here is the same without
123456789012345678901234567890
a b c

note the difference, and how the <code tagged> data is easier to understand

and ... learn to post in the proper section of the forum
determine the SORT product You are using and post in that product section

I hope that the duplicate post in the DFSORT forum was due repentance for havin started the topic in the wrong section :geek:

Re: Detail record sorting

PostPosted: Fri Feb 17, 2012 2:48 pm
by purva
Sorry for the inconvenience as I am posting for the first time.

123456789012345678901234567890
HH
AS,1234567,H,N,20120217
JR,W,2210
JR,W,2211
JR,w,2212

AS,1234561,H,N,20120215
JR,W,2201
JR,W,2202
JR,w,2203

TT
123456789012345678901234567890

Re: Detail record sorting

PostPosted: Fri Feb 17, 2012 2:50 pm
by enrico-sorichetti
the code tags... the frigging code tags

the <column> indicators were meant to show how <open> text eats the spaces
and how <coded> text preserves spaces

Re: Detail record sorting

PostPosted: Fri Feb 17, 2012 3:02 pm
by purva
Hope this helps!

1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0
HH
A S , 1 2 3 4 5 6 7 , H , N , 2 0 1 2 0 2 1 7
J R , w , 2 2 1 0
J R , w , 2 2 1 1
J R , w , 2 2 1 2

A S , 1 2 3 4 5 6 1 , H , N , 2 0 1 2 0 2 1 5
J R , w , 2 2 0 1
J R , w , 2 2 0 2
J R , w , 2 2 0 3

TT
1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0

Regards,
Purva

Re: Detail record sorting

PostPosted: Fri Feb 17, 2012 3:07 pm
by Nik22Dec
Purva,

Relax & Pay Attention. Please do not Quick Reply to this Thread. Instead, go for the Post Reply Option. Note that below the Subject Line, you will have a command line starting with "B". On the same line, you will find the Code tag. Please try using that once.

Before submitting your reply please press the Preview Button to have a look on your post.

Re: Detail record sorting

PostPosted: Fri Feb 17, 2012 3:10 pm
by enrico-sorichetti
I strongly suggest that You go see an ophtalmologist
can You notice the difference between <code tagged> text and open text ?

each letter is typed separated by 5 blanks and her is how it looks with the code tags
a     b     c     d


and here the same without the code tags
a b c d

while You type the space are shown, but as soon You hit preview/submit all the multiple/duplicate spaces are eliminated and reduced to single spaces

also <open> text usel a variable width font
<coded> text uses a fixed pitch font.

if You cannot You are unwilling to understand such simple things a career shift to a less demanding opportunity is strongly advised :mrgreen: