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
 

 

Eliminate Blank Records

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: Eliminate Blank Records
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    Post subject:
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

Site Director


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

PostPosted: Fri Jul 08, 2011 9:10 pm    Post subject: Reply to: Eliminate Blank Records
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    Post subject:
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    Post subject:
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    Post subject:
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: 2161
Location: @my desk

PostPosted: Mon Jul 11, 2011 1:18 pm    Post subject:
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    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7232

PostPosted: Mon Jul 11, 2011 2:51 pm    Post subject: Reply to: Eliminate Blank Records
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    Post subject:
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: 2161
Location: @my desk

PostPosted: Mon Jul 11, 2011 8:48 pm    Post subject:
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    Post subject:
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: 2161
Location: @my desk

PostPosted: Tue Jul 12, 2011 4:54 pm    Post subject: Reply to: Eliminate Blank Records
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to split the records using the am... vnktrrd DFSORT/ICETOOL 24 Fri Oct 28, 2016 7:33 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts abend sort based on count records in ... anatol DFSORT/ICETOOL 5 Mon Oct 17, 2016 10:10 pm
No new posts how to split records based on specifi... Venkata Ramayya DFSORT/ICETOOL 6 Wed Sep 28, 2016 3:20 am


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