COBOL - Date format to Binary ASCCII
Moderators: dbzTHEdinosauer, Moderator Group
-
- Member
- Posts: 18
- Joined: Tue Apr 15, 2014 4:18 pm
COBOL - Date format to Binary ASCCII
Hi ,
I need to convert Date format to Binary ASCII format in cobol . Please
someone help . If I found the answer , will share too .
I need to convert Date format to Binary ASCII format in cobol . Please
someone help . If I found the answer , will share too .
Attack1988
-
- Active Member
- Posts: 732
- Joined: Thu May 24, 2012 4:07 am
-
- Member
- Posts: 18
- Joined: Tue Apr 15, 2014 4:18 pm
William Collins,
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
http://publib.boulder.ibm.com/infocente ... psrv03.htm
Please make it clear .. i have recently seen some variable like
s9(09) Binary ! I dunno what it does too
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
http://publib.boulder.ibm.com/infocente ... psrv03.htm
Please make it clear .. i have recently seen some variable like
s9(09) Binary ! I dunno what it does too
Attack1988
-
- Active Member
- Posts: 732
- Joined: Thu May 24, 2012 4:07 am
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.
Code: Select all
COMP
COMP-4
BINARY
COMP-5
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.
-
- Member
- Posts: 18
- Joined: Tue Apr 15, 2014 4:18 pm
William Collins,
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
here ..
I thought it is used for reducing the size .. but never thought it s actually used for computation s to increase performance ..
http://www.csis.ul.ie/cobol/course/Usage.htm
I want to have more information about COMP ,, and its effect on computation .. where can i get that link ?
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
here ..
I thought it is used for reducing the size .. but never thought it s actually used for computation s to increase performance ..
http://www.csis.ul.ie/cobol/course/Usage.htm
I want to have more information about COMP ,, and its effect on computation .. where can i get that link ?
Attack1988
-
- Active Member
- Posts: 732
- Joined: Thu May 24, 2012 4:07 am
-
- Member
- Posts: 18
- Joined: Tue Apr 15, 2014 4:18 pm
-
- Active Member
- Posts: 732
- Joined: Thu May 24, 2012 4:07 am
Well, the link is both wrong and poor. You may have found it helpful, but it won't genuinely help you, because it means there are things you will misunderstand yet think that you understand.
However, you are fully free to think what you like. You will always have trouble explaining yourself to other people, but that will be your problem.
I don't mind explaining things three times to the same person. More requested, and I give up. You've used up two with this so far.
However, you are fully free to think what you like. You will always have trouble explaining yourself to other people, but that will be your problem.
I don't mind explaining things three times to the same person. More requested, and I give up. You've used up two with this so far.
Hello,
The way the material you linked IS rather easy to read, but it is not as useful as it could be.
I believe you have rather well understood what you read there, but it has not provided you with complete information. So what you know may be a bit short.
Believing something does not make it true . . .it taught me the basic good
The way the material you linked IS rather easy to read, but it is not as useful as it could be.
I believe you have rather well understood what you read there, but it has not provided you with complete information. So what you know may be a bit short.
Have a good one
-
- Member
- Posts: 18
- Joined: Tue Apr 15, 2014 4:18 pm
DikDude,
Hi , ok accept that .. But information i collect .. i will make sure its right ..
Then only share dont worry ^_^ .. I m kinda new to mainframe .. only three months studied .. but yea i like to solve other problems .. ^^
For my question ..
Yea this is the answer .. .. Usage is DISPLAY for EBCIDIC /ASCII
Usage is COMP for Binary
USage is COMP-3 for bcd format ^_^
anyway Thanks Williams .. ^^
Hi , ok accept that .. But information i collect .. i will make sure its right ..
Then only share dont worry ^_^ .. I m kinda new to mainframe .. only three months studied .. but yea i like to solve other problems .. ^^
For my question ..
Yea this is the answer .. .. Usage is DISPLAY for EBCIDIC /ASCII
Usage is COMP for Binary
USage is COMP-3 for bcd format ^_^
anyway Thanks Williams .. ^^
Attack1988
-
- Active Member
- Posts: 732
- Joined: Thu May 24, 2012 4:07 am
There's an example. COMP-3/PACKED-DECIMAL is NOT 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.
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.
-
- Member
- Posts: 18
- Joined: Tue Apr 15, 2014 4:18 pm
-
- Active Member
- Posts: 732
- Joined: Thu May 24, 2012 4:07 am
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.
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.
-
- Member
- Posts: 18
- Joined: Tue Apr 15, 2014 4:18 pm
-
- Active Member
- Posts: 732
- Joined: Thu May 24, 2012 4:07 am
FREE TUTORIALS
Tutorials
Free tutorials from mainframegurukul
- JCL Tutorial
Covers all important JCL concepts. - Cobol Tutorial
This tutorials covers all Cobol Topics from STRING to COMP-3. - DB2 Tutorial
DB2 Tutorial focuses on DB2 COBOL Programming. - SORT Tutorial
This Tutorial covers all important aspects of DFSORT with examples - CICS Tutorial
This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions
- Cobol Interview Questions
50+ Interview Questions - JCL Interview Questions
50+ Interview Questions - DB2 Interview Questions
100+ Interview Questions - CICS Interview Questions
70+ Interview Questions - VSAM Interview Questions
27 Interview Questions
Other References
Mainframe Tools and others
- XPEDITER Reference
Explains how we can debug a program - FILEAID Reference
Explains how to browse , edit and delete datasets - Change Man Reference
Quick Start tutorial on Changeman - Abend Reference
Important Abend codes explained - FaceBook Page
MainframeGurukul FaceBook Page - LinkedIn Page
MainframeGurkul Linkedin Page