Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

How can we create a flat file in JAVA with COMP-3 VALUES?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Java & MQSeries
View previous topic :: :: View next topic  
Author Message
rakesh.v18

New User


Joined: 14 Feb 2006
Posts: 7
Location: India

PostPosted: Fri Sep 23, 2016 10:46 pm    Post subject: How can we create a flat file in JAVA with COMP-3 VALUES?
Reply with quote

This file we need to send to mainframes after creating comp-3 values.
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7234

PostPosted: Fri Sep 23, 2016 10:55 pm    Post subject: Reply to: How can we create a flat file in JAVA with COMP-3 VALUES?
Reply with quote

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
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7913
Location: Bellevue, IA

PostPosted: Fri Sep 23, 2016 11:50 pm    Post subject:
Reply with quote

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
View user's profile Send private message
steve-myers

Active User


Joined: 30 Nov 2013
Posts: 461
Location: The Universe

PostPosted: Sat Sep 24, 2016 12:01 am    Post subject:
Reply with quote

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
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1610
Location: NY,USA

PostPosted: Sat Sep 24, 2016 1:15 am    Post subject:
Reply with quote

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
View user's profile Send private message
sergeyken

New User


Joined: 29 Apr 2008
Posts: 37
Location: Maryland

PostPosted: Sat Sep 24, 2016 1:23 am    Post subject:
Reply with quote

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
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7234

PostPosted: Sat Sep 24, 2016 1:59 am    Post subject: Reply to: How can we create a flat file in JAVA with COMP-3 VALUES?
Reply with quote

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
View user's profile Send private message
sergeyken

New User


Joined: 29 Apr 2008
Posts: 37
Location: Maryland

PostPosted: Sat Sep 24, 2016 5:55 pm    Post subject:
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Java & MQSeries All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts CICS Roll back partially - Need to re... dwijadas CICS 4 Wed Nov 16, 2016 4:30 pm
No new posts Problem in writing Output file vickey_dw COBOL Programming 5 Mon Nov 14, 2016 11:14 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us