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
 

 

Valid Values for a field should be A-Z or 0-9

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> PL/I & Assembler
View previous topic :: :: View next topic  
Author Message
suryamtechcse
Warnings : 1

New User


Joined: 28 Apr 2006
Posts: 9
Location: Chennai

PostPosted: Fri Jan 08, 2010 9:45 pm    Post subject: Valid Values for a field should be A-Z or 0-9
Reply with quote

Hi,

I am in need to write an assembler code:

I want to give valid values for a field called ACTATTR.

The valid values should be only A-Z or 0-9.

Code:
ACTATRTN   ------------Main Routine
CLI  ACTATTR,C'A'
BL   Error-routine
CLI  ACTATTR,C'Z'
BNH Exit-routine
BNE ACTAt09

ACTAT09  DS 0H
CLI  ACTATTR,C'0'
BL   Error-routine
CLI  ACTATTR,C'9'
BNH Exit-routine
BNE ACTAt09



Could you please provide me an Assembler code for this?

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

Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7995
Location: Bellevue, IA

PostPosted: Fri Jan 08, 2010 9:53 pm    Post subject:
Reply with quote

Probably the fastest way would be to use the TRT instruction. Googling assembler trt instruction returns 175,000 hits with plenty of examples on how to use it.
Back to top
View user's profile Send private message
suryamtechcse
Warnings : 1

New User


Joined: 28 Apr 2006
Posts: 9
Location: Chennai

PostPosted: Fri Jan 08, 2010 10:03 pm    Post subject:
Reply with quote

Hi Robert,

I am a beginner in Assembler. Could you please provide me exact code?

Thanks
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7995
Location: Bellevue, IA

PostPosted: Fri Jan 08, 2010 10:22 pm    Post subject:
Reply with quote

This is a help forum, not a DO-YOUR-JOB-FOR-YOU forum. Most of the people who monitor this forum are paid for their professional work product (such as assembler code). Unless you're willing to pay the appropriate amount for professional assistance (rates of USD 1000 per day are fairly typical), please do not ask for code. If you code it up on your own and have trouble, there's plenty of people willing to help you fix it. But unless you show some initiative by coding on your own, you're probably not going to see much support here.

You are expected to be able to research things, read manuals, and figure out things on your own.
Back to top
View user's profile Send private message
Ronald Burr

Active User


Joined: 22 Oct 2009
Posts: 293
Location: U.S.A.

PostPosted: Fri Jan 08, 2010 10:51 pm    Post subject:
Reply with quote

A warning is in order here - MANY have erred in thinking that all values between 'A' and 'Z' ( inclusive ) are alphabetic. In fact, they are NOT. In EBCDIC, the letter 'A' is hex 'C1' (x'C1') and the letter 'Z' is hex 'E9' (x'E9'). But between x'C1' and x'E9' there are values ( i.e. x'CA', x'CB', x'CC', x'CD', x'CE', x'CF', x'D0', x'DA', x'DB', x'DC', x'DE', x'DF', x'E0', and x'E1' ) which are NOT alphabetic. Do NOT neglect to account for these if you test individual bytes to determine if they are "alphabetic".
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2502
Location: Atlanta, Georgia, USA

PostPosted: Fri Jan 08, 2010 11:07 pm    Post subject: Reply to: Valid Values for a field should be A-Z or 0-9
Reply with quote

Yes, you must heed this warning and this is why a TRT table is your best choice for validating this data.

TRT's are issued (under the covers) by COBOL on a regular basis, such as -

IF field IS NUMERIC

IF field IS ALPHABETIC-UPPER AND field IS NOT = SPACE

The above tests will check field for 0-9 and A-Z characters.

To generate the Assembler expansion of a COBOL program which issue these tests, compile the program using the compile options LIST,NOOFFSET (normal default is NOLIST, OFFSET).

Bill
Back to top
View user's profile Send private message
Ronald Burr

Active User


Joined: 22 Oct 2009
Posts: 293
Location: U.S.A.

PostPosted: Fri Jan 08, 2010 11:27 pm    Post subject:
Reply with quote

One additional caution is now indicated.

It is never a good idea to test a ONE-BYTE field to see if it is NUMERIC or ALPHABETIC.

Why? Well, because if the value is x'C1' it will qualify as BOTH. That is, the value x'C1' is both a valid (signed) number ( value +1 ) AND a valid alphabetic character ( letter 'A' ).
To test a 1-byte field, either test the actual hex representation in accordance with your requirements, or move it to the last byte of a larger field that has been pre-filled with valid values (according to your requirements), and then test that larger field.
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2429
Location: Netherlands, Amstelveen

PostPosted: Sat Jan 09, 2010 12:34 pm    Post subject:
Reply with quote

Thats true Ronald, but i guess the TS is talking about characters, not the numeric values of 0-9, e.g. x'F0' - x'F9'.
But nevertheless TRT would do the job.
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 -> PL/I & Assembler All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Check Binary Values for symbols gandikk CA Products 3 Tue Mar 21, 2017 5:11 am
No new posts SORT VSAM file with each field one by... maxsubrat DFSORT/ICETOOL 6 Tue Mar 14, 2017 1:07 pm
No new posts IMS DB-How to update a record (a sing... Nic Clouston IMS DB/DC 9 Thu Mar 09, 2017 4:38 pm
No new posts To display values of multiple rows in... vinu78 DB2 2 Thu Mar 09, 2017 1:20 pm
No new posts outrec field outside range Danielle.Filteau SYNCSORT 10 Sat Mar 04, 2017 2:37 am


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