View previous topic :: View next topic
|
Author |
Message |
rakesh.v18
New User
Joined: 14 Feb 2006 Posts: 7 Location: India
|
|
|
|
This file we need to send to mainframes after creating comp-3 values. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Well, don't. Seen fixed-width character values, which actual decimal places (or explicit, or implicit, scaling), explicit sign. Can you do that? Then the Mainframe program can make it packed-decimal with no effort, and no code-silliness for you. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
I echo Bill's comment -- you really don't want to creat5e a file with packed decimal data in Java. Because if you want packed decimal, you MUST create the file as an EBCDIC file, not an ASCII file, since the conversion from ASCII to EBCDIC will completely corrupt your packed decimal values. For example, if the value is positive and ends in 3, 3C is the < character in ASCII -- but that translates to 4C in EBCDIC, so your packed decimal value just changed; many other bytes of the packed decimal data would also be changed in an ASCII-to-EBCDIC conversion. |
|
Back to top |
|
|
steve-myers
Active Member
Joined: 30 Nov 2013 Posts: 917 Location: The Universe
|
|
|
|
Certainly it can be done, but doing it is, well, dumb, to use a polite term more in keeping this site politically correct and using words that can be used in the presence of small children.
I wonder if rakesh.v18 realizes the crested file would require any text in the file to be EBCDIC and the file would have to be sent to the mainframe as a binary transfer? |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3076 Location: NYC,USA
|
|
|
|
This is a JAVA question and nothing to do with COBOL.
First you need to know comp-3 and then if you have any function which does that conversion to packed decimal then its good else you will need to put logic by yourself. But data corrupt may occur during ASCII to EBCDIC conversion. So why not sent the actual values in ZD and let Mainframes side , converts and read that to comp-3? |
|
Back to top |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2141 Location: USA
|
|
|
|
When COMP-3 data (i.e. Packed Decimal, i.e. DS PLn, etc.) are created as fields in a file to be transmitted to mainframe, it is possible, but the file transmission must be done in binary mode. In that case also all text data must be created in EBCDIC, binary fixed/float data - in IBM format, etc. etc. etc.
Usually it doesn't make much sense unless there are very specific reasons to do this (except "these are requirements from TL") |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
It is an absurd task which requires substantial coding/processing and all for no possible reason at all.
Yes, people do it, but more fool them. Also ask the audit/compliance/accounting departments. Tell them that instead of just using "print" statements to format your numeric data and allow the built-in ASCII-EBCDIC conversion of your transport mechanism, you want to do all of the conversions yourself, including accurately representing packed-decimal data, and the entire benefit is... nothing. To the detriment is a bag of code you know little about, which you have to cobble together from potentially ropey libraries (I'll bet not a single library actually knows all about packed-decimal data).
I'll show you the code on the Mainframe if you do all that work to provide the data in EBCDIC with packed-decimal numerics:
Code: |
MOVE my-input-numeric TO destination-numeric |
Now the code if you don't do all the stupid stuff, and just provide the data as fixed-width "character" data (leading zeros, actual decimal-point, actual sign (leading or trailing, whichever is easier).
Code: |
MOVE my-input-numeric TO destination-numeric |
Hey, you mean it makes absolutely no difference on the Mainframe, whatever I code? Yeah, pretty much. The only thing that needs to be different is the definition of your field. Funny that someone wants you to do shed-loads of work on something you know nothing about for absolutely no point, isn't it? |
|
Back to top |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2141 Location: USA
|
|
|
|
Such stupid requirements, like "create COMP-3 data in Java" continue to appear more and more often. Usually they are produced by undereducated managers who are crazy on "modern technologies". Whenever they've cought any term new to them immediately it is included in so called "functional specifications" to be implemented by their monkeys. |
|
Back to top |
|
|
|