View previous topic :: View next topic |
Author |
Message |
kolusu Site Admin
![Site Admin Site Admin](images/ranks/adminpic.jpg)
Joined: 26 Nov 2002 Posts: 12370 Topics: 75 Location: San Jose
|
Posted: Fri Dec 20, 2002 6:28 am Post subject: |
|
|
Rajeev,
I edited your post to put the code blocks to make the post more readable. you can click on the edit button and see how the CODE tags work.
When posting a reply you can see on the first line(Message Body) all tag functions for bold,italic,underline,quote,code...
so before pasting your source code click on the required button(code in this case) and after pasting the last line of your program click once again the code which will insert the closing code tag.By embedding the text in between code tags it will be easier to read and understand
Thanks
Kolusu |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
bkelle Beginner
Joined: 22 Jan 2003 Posts: 9 Topics: 3
|
Posted: Wed Jan 22, 2003 4:47 pm Post subject: |
|
|
Another way of checking would be
INSPECT FIELD TALLYING COUNT-1 FOR ALL ' '
IF COUNT-1 = ZERO AND FIELD IS ALPHABETIC
THEN PROCESS
ELSE
SET FIELD ERROR TO TRUE
END-IF |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
Dibakar Advanced
![](images/avatars/gallery/cartoons/WB70.gif)
Joined: 02 Dec 2002 Posts: 699 Topics: 63 Location: USA
|
Posted: Tue Jan 28, 2003 9:39 am Post subject: |
|
|
Thanks bkelle,
This is much better than multiple ifs.
Dibakar |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
Dibakar Advanced
![](images/avatars/gallery/cartoons/WB70.gif)
Joined: 02 Dec 2002 Posts: 699 Topics: 63 Location: USA
|
Posted: Wed Feb 05, 2003 4:34 am Post subject: |
|
|
Sorry this didn't work since I require to pass numbers as well. Like 'AAAA, 'A1B2' etc. Is there any command to do such check in VS COBOL II?
Dibakar. |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
Grant Beginner
Joined: 02 Dec 2002 Posts: 45 Topics: 1 Location: Sydney, NSW, Australia
|
Posted: Wed Feb 05, 2003 6:17 pm Post subject: |
|
|
Dibakar,
I think you'll find that Taterhead's suggestion is exactly what you are looking for. It's simple and efficient.
Code: |
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
SPECIAL-NAMES.
CLASS VALID-NAME
'A' THRU 'Z'
'0' THRU '9'.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 Var1 Pic x(4) value 'AB12'.
01 Var2 Pic x(4) value 'A C3'.
PROCEDURE DIVISION.
If Var1 VALID-NAME
Display 'Var1 is valid'
else
Display 'Var1 is invalid'
end-if.
If Var2 VALID-NAME
Display 'Var2 is valid'
else
Display 'Var2 is invalid'
end-if.
GOBACK.
|
The output is:
Var1 is valid
Var2 is invalid |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
DaveyC Moderator
![](images/avatars/gallery/starwars/swars041.gif)
Joined: 02 Dec 2002 Posts: 151 Topics: 3 Location: Perth, Western Australia
|
Posted: Wed Feb 05, 2003 9:05 pm Post subject: |
|
|
I agree with Grant. Special Names will build a translation table and will even be more effecient then rolling your own assembler program to do the TRT. _________________ Dave Crayford |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
Premkumar Moderator
![](images/avatars/gallery/babypics/maidsa.gif)
Joined: 28 Nov 2002 Posts: 77 Topics: 7 Location: Chennai, India
|
Posted: Wed Feb 05, 2003 11:47 pm Post subject: |
|
|
Beware of the non-alphabetic characters interspersed between "A" and "Z" in EBCDIC.
Define VALID-NAME class as
Code: |
SPECIAL-NAMES.
CLASS VALID-NAME 'A' THRU 'I'
'J' THRU 'R'
'S' THRU 'Z'
'0' THRU '9'.
|
or as Taterhead did. |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
Grant Beginner
Joined: 02 Dec 2002 Posts: 45 Topics: 1 Location: Sydney, NSW, Australia
|
Posted: Thu Feb 06, 2003 12:01 am Post subject: |
|
|
good pickup Premkumar ... |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
Dibakar Advanced
![](images/avatars/gallery/cartoons/WB70.gif)
Joined: 02 Dec 2002 Posts: 699 Topics: 63 Location: USA
|
Posted: Thu Feb 06, 2003 12:38 am Post subject: |
|
|
Thanks again, but as I am coding for script generated source I have access to only some specific places in working storage and procedure division. So I can't use special names.
I have tried multiple IFs or multiple PERFORMs but was wondering if there exist some clever use of INSPECT to do the same. |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
|
|