Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Difference between picture clause A and X

Status
Not open for further replies.

solanki123

Programmer
Jul 1, 2003
29
IN
Hi all,
Generally we do not use picture clause A, why?

Using picture clause X we can store both alphabetic as well as alphanumeric items. But if we are sure that we have to store alphabetic item, which picture clause should we prefer and why?
I heard that using X we can save memory but how it works internally ?
 
Hi,

indead picture A is not (so many times) used, I never saw it used in 25 years. A big difference can be when used in an accept. Try it!

There is no difference is storage between picture A and X.

Regards,

Crox
 
Crox what is that big difference if I use accept with A or X.
Somebody told me that if we declare pic X(100) and we store only 10 characters in it, it will occupy only 10 bytes instead of 100, is that true.
 
No, even if you use OCCURS DEPENDIG.
The storage area is allocated at compile time.

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
With an accept, the system accepts acceptable values. A numeric field will be numeric after an accept (at least with my compiler) and a picture A will contain alfabetic data.
 
ACCEPT and A vs X is a compiler (run-time) issue. PIC A is relatively uncommon and really doesn't get you much in an '85 Standard compiler.

In the 2002 Standard, there is a new VALIDATE facility that can use the difference between PIC A vs PIC X to "validate" whether the data of a current field is or is not alphabetic - but of course you have always been able to do this with the existing
IF ALPHABETIC
test.

FYI - some compilers / run-time use numeric versus alphanumeric with the ACCEPT statement to "turn on" a numeric key lock. Others do not do this.

Bill Klein
 
A = Alphabetic only alphabet.
X = Alphanumeric Alphabet and numbers.

I have never had a reason to use A. This may affect how numbers are redefined in a field but since I have never used it, I do not see a specific reason to use it. I guess at some level if you have fewer possibilities to choose from, than it might make the system faster.

Numbers can be alphabetic and numeric. Hex 31 = 1, Hex 241 = 1. I think the first one is actually the numeric value according to my old System 370 IBM Reference Summary form IBM Mainframe Codes. There could be a conversion process if you were forced to use Hex 241. I really dont know much about the compiler. It could be that when you use a number in alpha numeric (X) the compiler always stores the number one way or the other.

If you do not like my post feel free to point out your opinion or my errors.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top