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

Finding if a VSAM has null value records.


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1742
Location: Tirupur, India

PostPosted: Fri Aug 21, 2009 7:55 pm
Reply with quote

Hi,

I have a requirement in REXX to find if a record has any of the numbers from 1-9(except 0) in any position
and if the record has characters from A-Z in any position.

Code:
..................         -valid record
............00000000000..  -valid record
.....................      -valid record
//DLDOHI09 JOB CLASS=P,MS  -invalid record
00002028BC 1ABC-077        -invalid record
0000000920030111DUMMY FOR  -invalid record
0950200908191A 2009081718  -invalid record
110000001           19890  -invalid record
2009082018011900000000000  -invalid record
002006120950P700328GR B45  -invalid record
P188712200908191000020490  -invalid record
A 1                        -invalid record
0950008212009505655130352  -invalid record
                           -valid record
.........................  -valid record



If a record has 1-9 or A-Z in any place then the record has to be flagged invalid.
If a record has ....... or spaces or combination of them, then they have to be considered as valid.

I am trying to test the first record of a list of VSAM files if they have low value records or 000000's.

I tried the below code, but as you can see it is not capable to detecting records like " ....." or "0000...."
Could you please help.



Code:
      TEST_VALUE=SUBSTR(DATAS.1,1,30)                         
      TEST_VALUE2=C2X(TEST_VALUE)                                     
      SAY 'TEST_VALUE2 IS ' TEST_VALUE2                               
      IF (TEST_VALUE2 = 0 |,                                         
         TEST_VALUE = '000000000000000000000000000000') THEN         
      DO                                                             
        Q=Q+1                                                         
        MAKE.Q=FILE1 ' HAS NULL RECS'                                 
      END   




Thanks & Regards,
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Fri Aug 21, 2009 8:02 pm
Reply with quote

Quote:
.......
means nothing, it' s just a way for ISPF to tell that the chars are not displayable

so it would be nice to specify better Your requirement icon_biggrin.gif
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1742
Location: Tirupur, India

PostPosted: Fri Aug 21, 2009 8:10 pm
Reply with quote

Oh!.. I missed that point.


By .... i mean only x'000000' icon_biggrin.gif .


x'000000' = valid.
other .... hex values are invalid.

Code:

With HEX on mode..
.............
0000000000000
0000000000000


Hex mode:

Code:
0000000000000...
FFFFFFFFFFFFF000
0000000000000000


is also valid.



The bottom line is to, test if a line has 1-9 or A-Z in any position or not.

Pls let me know if you need more information.

Thanks,
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Fri Aug 21, 2009 8:19 pm
Reply with quote

I would TRANSLATE each line.
x'00' > x'00'
x'??' > x'31' where the ?? is everyother character except x'00'

then I would do a POS looking for x'31'.
When 0, then valid
otherwise invalid.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Fri Aug 21, 2009 8:29 pm
Reply with quote

here is a code snippet that will check for any unwanted chars

Code:
samp.0 = 3
samp.1 = ",.:;)(/"
samp.2 = "..123"
samp.3 = "ABC.DE"

invchar = "123456789ABCDEF"
do   i = 1 to samp.0
   if  0 = verify(samp.i,invchar,"M") then ,
      say "    VALID" samp.i
   else ,
      say "NOT VALID" samp.i
end

Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1742
Location: Tirupur, India

PostPosted: Fri Aug 21, 2009 8:49 pm
Reply with quote

Hi Enrico and DBZ,

Many Thanks for your help. I will cobble with the code given by Enrico.
It is sufficient for the requirement.

Thanks again,
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Fri Aug 21, 2009 8:57 pm
Reply with quote

Quote:
It is sufficient for the requirement.


actually, it is perfect.

I like giving solutions,
because enrico will always provide a more efficient solution.

I image VERIFY is much faster than TRANSLATE, POS.
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1742
Location: Tirupur, India

PostPosted: Fri Aug 21, 2009 9:05 pm
Reply with quote

Quote:
actually, it is perfect.


I totally agree..
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Fri Aug 21, 2009 9:13 pm
Reply with quote

oh, cm' on You wise guys icon_redface.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 -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts Access to non cataloged VSAM file JCL & VSAM 18
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
No new posts VB to FB - Finding LRECL SYNCSORT 4
No new posts Merge two VSAM KSDS files into third ... JCL & VSAM 6
Search our Forums:

Back to Top