Detail record sorting



JES, JES2, JCL utilities, IDCAMS, Compile & Run JCLs, PROCs etc...

Detail record sorting

Postby purva » Fri Feb 17, 2012 2:18 pm

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,
purva
 
Posts: 9
Joined: Thu Feb 16, 2012 11:34 am
Has thanked: 0 time
Been thanked: 0 time

Re: Detail record sorting

Postby purva » Fri Feb 17, 2012 2:20 pm

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.
purva
 
Posts: 9
Joined: Thu Feb 16, 2012 11:34 am
Has thanked: 0 time
Been thanked: 0 time

Re: Detail record sorting

Postby Nik22Dec » Fri Feb 17, 2012 2:25 pm

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.
Thanks,
Nik
User avatar
Nik22Dec
 
Posts: 68
Joined: Mon Dec 26, 2011 6:38 pm
Has thanked: 2 times
Been thanked: 0 time

Re: Detail record sorting

Postby purva » Fri Feb 17, 2012 2:31 pm

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.
purva
 
Posts: 9
Joined: Thu Feb 16, 2012 11:34 am
Has thanked: 0 time
Been thanked: 0 time

Re: Detail record sorting

Postby enrico-sorichetti » Fri Feb 17, 2012 2:40 pm

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:
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 2994
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 164 times

Re: Detail record sorting

Postby purva » Fri Feb 17, 2012 2:48 pm

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
purva
 
Posts: 9
Joined: Thu Feb 16, 2012 11:34 am
Has thanked: 0 time
Been thanked: 0 time

Re: Detail record sorting

Postby enrico-sorichetti » Fri Feb 17, 2012 2:50 pm

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
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 2994
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 164 times

Re: Detail record sorting

Postby purva » Fri Feb 17, 2012 3:02 pm

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
purva
 
Posts: 9
Joined: Thu Feb 16, 2012 11:34 am
Has thanked: 0 time
Been thanked: 0 time

Re: Detail record sorting

Postby Nik22Dec » Fri Feb 17, 2012 3:07 pm

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.
Thanks,
Nik
User avatar
Nik22Dec
 
Posts: 68
Joined: Mon Dec 26, 2011 6:38 pm
Has thanked: 2 times
Been thanked: 0 time

Re: Detail record sorting

Postby enrico-sorichetti » Fri Feb 17, 2012 3:10 pm

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:
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 2994
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 164 times

Next

Return to JCL

 


  • Related topics
    Replies
    Views
    Last post