Home      Mainframe Forum      Mainfarme Tutorials      IBM Manuals      Mainframe Interview Questions      Mainframe Books      IT News     SiteMap     Downloads


     
 
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

Google
 
Web mainframegurukul.com

COBOL - Date format to Binary ASCCII
Goto page 1, 2  Next
 
Post new topic   Reply to topic    mainframegurukul.com Forum Index -> COBOL
  View previous topic :: View next topic  
Author Message
Attack1988
Member


Joined: 15 Apr 2014
Posts: 18

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Wed Apr 16, 2014 6:14 pm    Post subject: COBOL - Date format to Binary ASCCII Reply with quote

Hi ,

I need to convert Date format to Binary ASCII format in cobol . Please

someone help . If I found the answer , will share too Smile .
_________________
Attack1988
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.

William Collins
Active Member


Joined: 24 May 2012
Posts: 732

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Wed Apr 16, 2014 7:58 pm    Post subject: Reply with quote

What, exactly, with references to the manuals and example data definitions, do you mean by "Date format" and "Binary ASCII format"?
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
Attack1988
Member


Joined: 15 Apr 2014
Posts: 18

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Thu Apr 17, 2014 8:29 am    Post subject: Reply with quote

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/infocenter/comphelp/v7v91/index.jsp?topic=%2Fcom.ibm.aix.cbl.doc%2Frpsrv03.htm
Please make it clear .. i have recently seen some variable like
s9(09) Binary ! I dunno what it does too
_________________
Attack1988
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
William Collins
Active Member


Joined: 24 May 2012
Posts: 732

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Thu Apr 17, 2014 11:25 am    Post subject: Reply with quote

If you need anything in binary, there are one of four things you can specify as the USAGE on the data definition.

Code:
COMP
COMP-4
BINARY

COMP-5


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.
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
Attack1988
Member


Joined: 15 Apr 2014
Posts: 18

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Fri Apr 18, 2014 11:20 am    Post subject: Reply with quote

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 ?
_________________
Attack1988
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
William Collins
Active Member


Joined: 24 May 2012
Posts: 732

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Fri Apr 18, 2014 12:43 pm    Post subject: Reply with quote

That seems to be quite a poor document that you have provided a link for.

Instead, use the Enterprise COBOL manuals. In fact, take your link, look up all of those things in the Enterprise COBOL manuals, then you'll know more and see how inaccurate the link is.
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
Attack1988
Member


Joined: 15 Apr 2014
Posts: 18

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Fri Apr 18, 2014 3:17 pm    Post subject: Reply with quote

I dont think so .. it taught me the basic good

U call it poor ? in the sense .. explain somethin wrong in that ^^ Keeping things simple doesnt mean its wrong ..
_________________
Attack1988
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
William Collins
Active Member


Joined: 24 May 2012
Posts: 732

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Fri Apr 18, 2014 3:41 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
DikDude
Moderator


Joined: 22 Jul 2011
Posts: 1001
Location: usa

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Sat Apr 19, 2014 12:19 am    Post subject: Reply with quote

Hello,

Quote:
it taught me the basic good
Believing something does not make it true . . .

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
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
Attack1988
Member


Joined: 15 Apr 2014
Posts: 18

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Mon Apr 21, 2014 9:39 am    Post subject: Reply with quote

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 .. ^^
_________________
Attack1988
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
William Collins
Active Member


Joined: 24 May 2012
Posts: 732

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Mon Apr 21, 2014 12:48 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
Attack1988
Member


Joined: 15 Apr 2014
Posts: 18

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Mon Apr 21, 2014 1:57 pm    Post subject: Reply with quote

William Collins, so you are saying comp-3 is bcd format only if its variable is

9 type and not X type ?
_________________
Attack1988
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
William Collins
Active Member


Joined: 24 May 2012
Posts: 732

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Mon Apr 21, 2014 2:56 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
Attack1988
Member


Joined: 15 Apr 2014
Posts: 18

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Mon Apr 21, 2014 4:02 pm    Post subject: Reply with quote

William Collins,

ok ok i understand what you are trying to say ..


Will do this later ..

then will talk about it .. not now ..
_________________
Attack1988
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
William Collins
Active Member


Joined: 24 May 2012
Posts: 732

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Mon Apr 21, 2014 4:34 pm    Post subject: Reply with quote

OK. Do you mean "what you are trying to say" or "what you are saying". If it is the former, you don't Smile
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
Display posts from previous:   
Post new topic   Reply to topic    mainframegurukul.com Forum Index -> COBOL All times are GMT + 5 Hours
Goto page 1, 2  Next
Page 1 of 2



 
Jump to:  
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
INTERVIEW Questions
This page covers important interview questions
Mainframe Jobs
Mainframe Jobs posted by members of mainframegurukul forum
FaceBook Page
MainframeGurukul FaceBook Page
LinkedIn Page
MainframeGurkul Linkedin Page

This widget requires Flash Player 9 or better







Go to top of the page
 

Online ABEND Reference ||  JCL References ||  COBOL References ||  VSAM References ||  Tutorials by Drona Series ||  SQL tutorial ||  BOOKS  ||  DB2 INTERVIEW QUESTIONS ||  COBOL INTERVIEW QUESTIONS  ||  JCL INTERVIEW QUESTIONS ||  JCL2 INTERVIEW QUESTIONS ||  VSAM INTERVIEW QUESTIONS ||  CICS INTERVIEW QUESTIONS  ||  Online tutorials ||  Online ABEND Reference ||  JCL References ||  COBOL References ||  VSAM References ||  Tutorials by Drona Series ||  SQL tutorial ||  BOOKS  ||  SiteMap  ||  Expeditor Tutorial  ||  FILE-AID Tutorial  ||  Changeman Tutorial  ||  COBOL   ||  DB2   ||  JCL  ||  CICS  ||  VSAM  ||  DB2 Interview Questions ( 110 )   || Simple JCL Tutorials  || JCL Tutorial from MainframeGurukul.com   || Simple JCL Tutorial - Chapter1 ;|| Mainframe Forum - Tutorials  || Mainframe Tutorials || Mainframe CICS tutorial|| Mainframe COBOL Tutorial

Drona Educational Forums - Mainframe Cobol DB2 CICS Board
Powered by phpBB

mainframetopic-7538.html