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

TRT saving


IBM Mainframe Forums -> PL/I & Assembler
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Pankaj Shrivastava
Currently Banned

New User


Joined: 24 Jul 2009
Posts: 51
Location: Pune

PostPosted: Wed Aug 05, 2009 2:03 pm
Reply with quote

Hi ,

Is there any way we can avoid declaring a table of 256 byte in TRT when i need to check a byte for Numeric only .

thanks
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


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

PostPosted: Wed Aug 05, 2009 3:49 pm
Reply with quote

You can check the one-byte (using a CLI) for a value not less than X'F0' (C'0') and not greater than X'F9' (C'9').

I'm assuming you're talking about display-numeric data and not packed-decimal data?

Is this CICS/Assembler?

Bill
Back to top
View user's profile Send private message
Pankaj Shrivastava
Currently Banned

New User


Joined: 24 Jul 2009
Posts: 51
Location: Pune

PostPosted: Wed Aug 05, 2009 3:55 pm
Reply with quote

Hi Bill ,

I have to go for TRT , sorry my question appeared as if i have one byte only ..I have to check each byte in a string for numeric . i.e I have 20 byte of string and need to check if is pure numeric .

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

CICS Moderator


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

PostPosted: Wed Aug 05, 2009 4:06 pm
Reply with quote

Define your table as 256X'04', then ORG table+240 with XL10'00'.

If the field contains all numerics, then a CC "BZ" will be raised after the TRT.

Otherwise, R1 will contain the address of the bad-byte and R2 will contain the actual byte-value found.

Optionally, you can clear R1 and R2 to X'00's before the TRT, but it's not necessary.

Some shops have pre-defined tables, which you can bring into the program, via an MVS LOAD Macro (Batch) or CICS LOAD PROGRAM (CICS). It saves base-register addressability and allows a common table for validation, available to all programs.

Bill
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


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

PostPosted: Wed Aug 05, 2009 6:38 pm
Reply with quote

Optionally, you could use a BCT loop. R14 and R15 are used in this example and should not be a problem. R1 will contain the number of non-numeric bytes found.

Code:

NUMERIC  DS    CL20
*
               SLR   R1,R1
               LA    R14,NUMERIC+L'NUMERIC-1
               LA    R15,L'NUMERIC
NUMLOOP  EQU   *
               CLI   0(R14),C'0'
               BL    NUMFAIL
               CLI   0(R14),C'9'
               BNH   NUMBUMP
NUMFAIL  EQU   *
               LA    R1,1(,R1)
NUMBUMP  EQU   *
               BCTR  R14,0
               BCT   R15,NUMLOOP
               LTR   R1,R1
               BZ    NUMGOOD
* IF THE LTR FAILS (CC IS NOT ZERO), THEN THE NUMERIC FIELD IS NON-NUMERIC
NUMGOOD  EQU   *                               

Bill
Back to top
View user's profile Send private message
Pankaj Shrivastava
Currently Banned

New User


Joined: 24 Jul 2009
Posts: 51
Location: Pune

PostPosted: Wed Aug 05, 2009 6:50 pm
Reply with quote

Thx Bill , The code is very useful .
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 -> PL/I & Assembler

 


Similar Topics
Topic Forum Replies
No new posts Do we need to restart DB2 Z/OS for DA... DB2 0
No new posts saving your settings in ISPF. TSO/ISPF 9
No new posts Daylight Saving this Weekend All Other Mainframe Topics 1
No new posts soc4 error while saving vsam file in ... IBM Tools 2
No new posts CA-ROSCOE saving member name problem . CA Products 6
Search our Forums:

Back to Top