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

Eliminate Blank Records


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
gylbharat

Active Member


Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

PostPosted: Fri Jul 08, 2011 7:37 pm
Reply with quote

Hi,
I am using SYNCSORT.
I am trying to write a sort step that will do the following.

INPUT
Code:

----+----1----+----2----+----3----+----4----+--
***************************** Top of Data *****
XXXXXXX TTTTTTTTTTT TTTTTTTT     C5140097     
XXXXXXX TTTTTTTTTTT TTTTTTTT     C5140097     
XXXXXXX QQ QQQ                   C51956       
XXXXXXX QQ QQQ                   C51956       
XXXXXXX QQ QQQ                   C51956       
XXXXXXX QQ QQQ                   C51956       
XXXXXXX BBBBB BBBBB BBBBBBB      C547         
XXXXXXX BBBBB BBBBB BBBBBBB      C547         
                                 C547         
XXXXXXX BBBBB BBBBB BBBBBBB      C547         
XXXXXXX BBBBB BBBBB BBBBBBB      C547         
                                 C547         
XXXXXXX BBBBB BBBBB BBBBBBB      C547         
                                 C5475630047   
                                 C5475630047   
XXXXXXX KKKKKKKKKK KKKK KKKK     C5999957     
XXXXXXX VVVV VVV VVVVVVVV-VVVV   C5999987     
XXXXXXX VVVV VVV VVVVVVVV-VVVV   C5999987     



OUTPUT
Code:

----+----1----+----2----+----3----+----4----+--       
***************************** Top of Data *****
XXXXXXX TTTTTTTTTTT TTTTTTTT     C5140097     
XXXXXXX QQ QQQ                   C51956       
XXXXXXX KKKKKKKKKK KKKK KKKK     C5999957     
XXXXXXX VVVV VVV VVVVVVVV-VVVV   C5999987     


The logic is to consider entire record as key.
Output should not have duplicates.
And if any instance of a records has some fields missing then the entire key is NOT written to the output file. Like the below records were not written to output as they had some fields missing in an instance of that key.
Code:


XXXXXXX BBBBB BBBBB BBBBBBB      C547
                                 C547
                                 C5475630047



Can you please help me on this.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Fri Jul 08, 2011 8:08 pm
Reply with quote

Quote:
The logic is to consider entire record as key.


Quote:
And if any instance of a records has some fields missing then the entire key is NOT written to the output file


so is the key the entire record, or is the key at certain col positions?
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19243
Location: Inside the Matrix

PostPosted: Fri Jul 08, 2011 9:10 pm
Reply with quote

Or are there really no rules at all. . . icon_sad.gif

You need to post what should happen in each case and why.

If you don't post the rules, this topic needs to be locked or completely deleted.

d
Back to top
View user's profile Send private message
gylbharat

Active Member


Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

PostPosted: Mon Jul 11, 2011 11:49 am
Reply with quote

Hi Dick,


Yes, The entire key is the record. In the above Input scenario...

Key -
Code:
XXXXXXX TTTTTTTTTTT TTTTTTTT     C5140097
was repeated 2 times so it was written to output record.

Case 2: -
Code:
XXXXXXX BBBBB BBBBB BBBBBBB      C547 
was having 7 instances. But some instances were empty like
Code:
                                 C547
so this record was skipped from the output file.
Back to top
View user's profile Send private message
gylbharat

Active Member


Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

PostPosted: Mon Jul 11, 2011 11:52 am
Reply with quote

similarly case 3:

Code:
                                 C5475630047   
                                 C5475630047   
are both same but all the positions are not filled in the record so it was also skipped from the output file. There are 3 fields in the input file
1. --> Pos 1 to 8
2 --> Pos 9 to 33
3 --> Pos 34 to 47.

Please let me know incase more information is required.
Back to top
View user's profile Send private message
gylbharat

Active Member


Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

PostPosted: Mon Jul 11, 2011 11:53 am
Reply with quote

similarly case 3:

Code:
                                 C5475630047   
                                 C5475630047   
are both same but all the positions are not filled in the record so it was also skipped from the output file. There are 3 fields in the input file
1. --> Pos 1 to 8
2 --> Pos 9 to 33
3 --> Pos 34 to 47.

I hope this is clear now.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Mon Jul 11, 2011 1:18 pm
Reply with quote

gylbharat,

Will there be entire blank records?
Will your 3rd field(Pos 34 to 47) always have some value?
Is your input already sorted on any field?
Input RECFM/LRECL?
Back to top
View user's profile Send private message
gylbharat

Active Member


Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

PostPosted: Mon Jul 11, 2011 2:49 pm
Reply with quote

Yes the file is sorted from 34 to 47. as shown in the input... And 3rd field will always have a value... RECFM = FB and input LRECL = 47.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Jul 11, 2011 2:51 pm
Reply with quote

So, for the blank fields the data is "inherited" from the previous non-blanks, but, can actually be ignored because of the assumption that the data is "valid", ie there is always a complete key as the first one of a sequence, the other side being that a field with blanks is known to be duplicate so can be ignored.

However, what about the possibility that the file is not like that? That it should be, but it is not valid.

If the answer to one of Arun's questions, about entirely blank, is no, then you will have a key element to do the match, inherit non-blanks (for the matching only) and just do the usual processing. Any "dodgy" records will appear on the output, but for a genuine reason (file stuffed).
Back to top
View user's profile Send private message
gylbharat

Active Member


Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

PostPosted: Mon Jul 11, 2011 5:35 pm
Reply with quote

No... There will be no entirely blank records.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Mon Jul 11, 2011 8:48 pm
Reply with quote

Here's a quick one which I think works for the OP's requirement. I'll have a look tomorrow if this could be fine tuned.
Code:
//SYSIN    DD  *                                                     
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,8,ZD,RESTART=(34,14))),
        IFTHEN=(WHEN=GROUP,BEGIN=(81,8,ZD,EQ,1),PUSH=(89:ID=8)),     
        IFTHEN=(WHEN=(1,8,CH,EQ,C' ',OR,9,25,CH,EQ,C' '),           
                OVERLAY=(81:C'00000000'))                           
  SORT FIELDS=(89,8,CH,A,81,8,CH,A)                                 
  OUTREC IFTHEN=(WHEN=INIT,OVERLAY=(97:SEQNUM,8,ZD,RESTART=(34,14))),
         IFTHEN=(WHEN=GROUP,BEGIN=(97,8,ZD,EQ,1),PUSH=(89:81,8)),   
         IFTHEN=(WHEN=(89,8,ZD,NE,0),                               
                OVERLAY=(105:SEQNUM,8,ZD,RESTART=(1,47)))           
  OUTFIL BUILD=(1,47),INCLUDE=(105,8,ZD,EQ,1)     
SORTOUT
Code:
XXXXXXX TTTTTTTTTTT TTTTTTTT     C5140097
XXXXXXX QQ QQQ                   C51956 
XXXXXXX KKKKKKKKKK KKKK KKKK     C5999957
XXXXXXX VVVV VVV VVVVVVVV-VVVV   C5999987
Back to top
View user's profile Send private message
gylbharat

Active Member


Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

PostPosted: Tue Jul 12, 2011 11:10 am
Reply with quote

Thanks Arun... This worked very well...
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Tue Jul 12, 2011 4:54 pm
Reply with quote

You're welcome icon_smile.gif
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts combine multiple unique records into ... DFSORT/ICETOOL 2
No new posts how to eliminate null indicator value... DB2 7
No new posts To Omit records based n SORT condition DFSORT/ICETOOL 6
No new posts To fetch records that has Ttamp value... DFSORT/ICETOOL 5
No new posts ICETOOL returns no records JCL & VSAM 1
Search our Forums:

Back to Top