MAINFRAME - TIP OF THE DAY :
When you specified V for RECFM parameter, LRECL value is largest record in the file plus 4 bytes. These four bytes contain the actual length of each variable length record in the file
Programmers Voted for below topics. Please Vote for good Posts.
Thank You! for your feedback. Connecting to the server. Please Wait...
Thanks for asking . I have a date say I have converted to ..Integer using Function Of Integer .. now its in 9(08) ;
now I want this Integer to be in Binary (like 1010101) and In ASCII too
Is there any data item like s9(09) Binary ASCII ? where we can simply move and convert intoo Binary and Ascii or we have to perform calculation ? OR is there any separate calling programs for this .. ? like
CEECBLDY—convert date to COBOL integer format
Please make it clear .. i have recently seen some variable like
s9(09) Binary ! I dunno what it does too _________________ Attack1988
If you need anything in binary, there are one of four things you can specify as the USAGE on the data definition.
COMP/COMP-4/BINARY are all identical. You should use whichever is used at your site. These definitions hold a value in binary with its maximum and minimum defined by the PICture. So, PIC 9(4) has a minimum value of zero, maximum value of 9999. PIC S9(3) has a minimum value of -999 and a maximum value of +999.
For COMP-5, the PICture defines the size of storage, and the binary value is only limited by the size of that storage. PIC 9(4) has a maximum of (2^16)-1 (two bytes of 8-bit storage) and a minimum of zero.
On the Mainframe, EBCDIC is the standard byte-encoding system. Outside, generally ASCII is the standard. Binary fields, which are not single bytes anyway, have bit patterns which are the same, though Endianness has to be catered for.
So, a binary field is no problem. Now you need to explain the ASCII aspect of it. What do you mean by needing the ASCII value? Show some sample data, and what that should be understood to mean.
YEA got a idea from u and from various sites i browsed .....
comp-binary-computational ,comp-4 comp-5 are in binary
comp-3 in bcd format ,
I dunno about comp-1 comp-2
when we use USAGE IS DISPLAY It is stored in EBCIDIC in Mainframe .. can be viewed as ASCII in Windows ..
I got mor info about COMP
I thought it is used for reducing the size .. but never thought it s actually used for computation s to increase performance ..
I want to have more information about COMP ,, and its effect on computation .. where can i get that link ? _________________ Attack1988
There's an example. COMP-3/PACKED-DECIMAL isNOT BCD.
This is not the first time I've seen this false assertion recently. Perhaps that incorrect page is too easy to locate.
PIC X can contain any of the 256 possible bit-patterns, and need not be either ASCII or EBCDIC. PIC 9 is conventionally a limited sub-set of values, but be aware that in practice the compiler does not limit them. If you put rubbish in there, nothing except your own code will stop you garbling bad data to good, unless you get an Abend.
BINARY/COMP/COMP-4 and COMP-5 are all binary. The first three are identical to each other (they are synonyms to the compiler). The last is different.
I'm not sure of your method of knowing what is correct, but you need to improve on it.
No, I'm saying several different things at the same time.
COMP-3/PACKED-DECIMAL is not, not, not, not, not, BCD. OK? Not.
Look for a definition of BCD. If that definition says it is packed-decimal, discard it and look for another. Repeat until you know what BCD is and what packed-decimal is. Treat anything which says that BCD is packed-decimal, or vice-versa, with great suspicion, as they are NOT.
Find out, reliably, what ASCII and EBCDIC actually are. Realise that a PIC X(n) field has nothing to do directly with either ASCII or EBCDIC.
Realise that even a field defined as PIC 9 (USAGE DISPLAY by default) can actually contain any of the 256 bit patterns for an 8-bit byte.
There are two types of binary in Enterprise COBOL. You need to know the different between them.
So, that's four different things. Unconnected to each other, but which despite your commendable efforts so far you have some confusions about.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
Cobol Tutorial This cobol tutorial covers most of the important topics like STRING, UNSTRING, COMP, COMP-3.....
DB2 Tutorial DB2 Tutorial focuses on DB2 COBOL Programming. Explains in simple language. Some Chapters are locked, Forum members have free access to these chapters
CICS Tutorial This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming...
JCL Tutorial This is most popular JCL tutorial from mainframegurukul. It does contain important jcl ....
SORT Tutorial This Tutorial covers all important aspects of DFSORT. Has more SORT examples