Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Compare char with ampersand in AIF or SETB
Hello:

I'm trying to figure our how to code a SETB instruction to check if a
one-byte character string contains an ampersand, an apostrophe or a hyphen.
Apost and hyphen work fine, but I can't find a way to get a match with the
ampersand.  See my test case below.  Thanks in advance for your help.

--
Gilbert Saint-Flour
http://gsf-soft.com


//GILBERTM JOB (ACCT#),STRING,
// NOTIFY=&SYSUID,
// CLASS=A,MSGCLASS=X,COND=(0,NE)
//HLASM EXEC PGM=ASMA90,PARM=(NOOBJECT,NORXREF)
MACRO
&NAME    STRING
&I       SETA  1
&J       SETA  2
.*LOOP
.LIT11C  ANOP
&K       SETC  '&SYSLIST(&I)'(&J,1)
&B       SETB  ('&K' EQ '&&' OR '&K' EQ '''' OR '&K' EQ '-')
MNOTE '     J=&J KK=&K&K B=&B '
&J       SETA  &J+1
AIF   (&J LT K'&SYSLIST(&I) ).LIT11C
.*ENDLOOP
MEND
 ****************************************
***********************
STRING '&&'
STRING ''''
STRING '--'
END
//SYSPRINT DD SYSOUT=*
//SYSLIB   DD DSN=SYS1.MACLIB,DISP=SHR
//SYSUT1   DD UNIT=VIO,SPACE=(CYL,2)


Report this thread to moderator Post Follow-up to this message
Old Post
Gilbert Saint-Flour
10-22-04 08:55 PM


Re: Compare char with ampersand in AIF or SETB
It is some 20 years since I worked with conditional assembly but
I have in my archives a macro with some code that I used to parse
a text parameter for valid quotes (including the surrounding),or
ampersands. This might give you some ideas?

.TXT     AIF   (K'&TXT LT 3).ERR08              IF TEXT INVALID
AIF   ('&TXT'(1,1) NE '''' OR '&TXT'(K'&TXT,1) NE '''').ERR08
&$$(7)   SETA  K'&TXT-2                         LENGTH OF TEXT
&A(7)    SETA  K'&TXT-1                         LAST TEXT BYTE
&A(8)    SETA  1                                TEXT BYTE POINTER
.TX1     AIF   (&A(8) EQ &A(7)).EXIT            IF DONE
&A(8)    SETA  &A(8)+1                          NEXT TEXT BYTE
AIF   ('&TXT'(&A(8),1) EQ '''').TX2    IF QUOTE
AIF   ('&TXT'(&A(8),1) NE '&&').TX1    IF NOT AMPERSAND
.TX2     AIF   (&A(8) EQ &A(7)).ERR08           IF AT END OF STRING
AIF   ('&TXT'(&A(8),1) NE '&TXT'(&A(8)+1,1)).ERR08 IF NOT DOUBLED
&$$(7)   SETA  &$$(7)-1                         DECREMENT TEXT LENGTH
&A(8)    SETA  &A(8)+1                          SKIP DOUBLED BYTE
AGO   .TX1                             LOOP BACK

regards Sven

"Gilbert Saint-Flour" <usenet5678@yahoo.com> wrote in message
news:u_Kdne_3BYFHxOTcRVn-1w@comcast.com...
> Hello:
>
> I'm trying to figure our how to code a SETB instruction to check if a
> one-byte character string contains an ampersand, an apostrophe or a
> hyphen.
> Apost and hyphen work fine, but I can't find a way to get a match with the
> ampersand.  See my test case below.  Thanks in advance for your help.
>
> --
> Gilbert Saint-Flour
> http://gsf-soft.com
>
>
> //GILBERTM JOB (ACCT#),STRING,
> // NOTIFY=&SYSUID,
> // CLASS=A,MSGCLASS=X,COND=(0,NE)
> //HLASM EXEC PGM=ASMA90,PARM=(NOOBJECT,NORXREF)
>         MACRO
> &NAME    STRING
> &I       SETA  1
> &J       SETA  2
> .*LOOP
> .LIT11C  ANOP
> &K       SETC  '&SYSLIST(&I)'(&J,1)
> &B       SETB  ('&K' EQ '&&' OR '&K' EQ '''' OR '&K' EQ '-')
> MNOTE '     J=&J KK=&K&K B=&B '
> &J       SETA  &J+1
>         AIF   (&J LT K'&SYSLIST(&I) ).LIT11C
> .*ENDLOOP
>         MEND
>  ****************************************
***********************
>         STRING '&&'
>         STRING ''''
>         STRING '--'
>         END
> //SYSPRINT DD SYSOUT=*
> //SYSLIB   DD DSN=SYS1.MACLIB,DISP=SHR
> //SYSUT1   DD UNIT=VIO,SPACE=(CYL,2)
>



Report this thread to moderator Post Follow-up to this message
Old Post
Sven Pran
10-23-04 01:55 AM


Re: Compare char with ampersand in AIF or SETB
Gilbert Saint-Flour <usenet5678@yahoo.com> wrote in message news:<u_Kdne_3BYFHxOTcRVn-1w@co
mcast.com>...
> Hello:
>
> I'm trying to figure our how to code a SETB instruction to check if a
> one-byte character string contains an ampersand, an apostrophe or a hyphen
.
> Apost and hyphen work fine, but I can't find a way to get a match with the
> ampersand.  See my test case below.  Thanks in advance for your help.

The problem is that '&&' stands for TWO ampersands in the macro language
(to make other things easier), so use '&&'(1,1) for one ampersand.

Michel.

Report this thread to moderator Post Follow-up to this message
Old Post
Michel Hack
10-23-04 08:55 PM


Re: Compare char with ampersand in AIF or SETB
It is some 20 years since I worked with conditional assembly but
I have in my archives a macro with some code that I used to parse
a text parameter for valid quotes (including the surrounding),or
ampersands. This might give you some ideas?

.TXT     AIF   (K'&TXT LT 3).ERR08              IF TEXT INVALID
AIF   ('&TXT'(1,1) NE '''' OR '&TXT'(K'&TXT,1) NE '''').ERR08
&$$(7)   SETA  K'&TXT-2                         LENGTH OF TEXT
&A(7)    SETA  K'&TXT-1                         LAST TEXT BYTE
&A(8)    SETA  1                                TEXT BYTE POINTER
.TX1     AIF   (&A(8) EQ &A(7)).EXIT            IF DONE
&A(8)    SETA  &A(8)+1                          NEXT TEXT BYTE
AIF   ('&TXT'(&A(8),1) EQ '''').TX2    IF QUOTE
AIF   ('&TXT'(&A(8),1) NE '&&').TX1    IF NOT AMPERSAND
.TX2     AIF   (&A(8) EQ &A(7)).ERR08           IF AT END OF STRING
AIF   ('&TXT'(&A(8),1) NE '&TXT'(&A(8)+1,1)).ERR08 IF NOT DOUBLED
&$$(7)   SETA  &$$(7)-1                         DECREMENT TEXT LENGTH
&A(8)    SETA  &A(8)+1                          SKIP DOUBLED BYTE
AGO   .TX1                             LOOP BACK

regards Sven

"Gilbert Saint-Flour" <usenet5678@yahoo.com> wrote in message
news:u_Kdne_3BYFHxOTcRVn-1w@comcast.com...
> Hello:
>
> I'm trying to figure our how to code a SETB instruction to check if a
> one-byte character string contains an ampersand, an apostrophe or a
> hyphen.
> Apost and hyphen work fine, but I can't find a way to get a match with the
> ampersand.  See my test case below.  Thanks in advance for your help.
>
> --
> Gilbert Saint-Flour
> http://gsf-soft.com
>
>
> //GILBERTM JOB (ACCT#),STRING,
> // NOTIFY=&SYSUID,
> // CLASS=A,MSGCLASS=X,COND=(0,NE)
> //HLASM EXEC PGM=ASMA90,PARM=(NOOBJECT,NORXREF)
>         MACRO
> &NAME    STRING
> &I       SETA  1
> &J       SETA  2
> .*LOOP
> .LIT11C  ANOP
> &K       SETC  '&SYSLIST(&I)'(&J,1)
> &B       SETB  ('&K' EQ '&&' OR '&K' EQ '''' OR '&K' EQ '-')
> MNOTE '     J=&J KK=&K&K B=&B '
> &J       SETA  &J+1
>         AIF   (&J LT K'&SYSLIST(&I) ).LIT11C
> .*ENDLOOP
>         MEND
>  ****************************************
***********************
>         STRING '&&'
>         STRING ''''
>         STRING '--'
>         END
> //SYSPRINT DD SYSOUT=*
> //SYSLIB   DD DSN=SYS1.MACLIB,DISP=SHR
> //SYSUT1   DD UNIT=VIO,SPACE=(CYL,2)
>



Report this thread to moderator Post Follow-up to this message
Old Post
Sven Pran
10-28-04 01:55 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

ASM370 archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 04:40 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.