Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Another Newbie question about text files...
I have a COBOL question for you.  I am attempting to create a text file
in which a COBOL program will read it in.  My question is, if I have
for instance a variable defined as INPUT-IVR-DIS-GRP PIC 9(4) VALUE 0,
what would I put in the text file to signify no value for this?  Would
it just be 4 spaces, 4 zeros, 4 9's?  I have about 1% of knowledge in
COBOL.  The program generating the text file is written in vb.  Thanks
for any help you can offer.





Here are all the variables that the COBOL program is reading in from
the text file.



03 INPUT-IVR-ITEM-TEMPLATE PIC X(18) VALUE SPACES.

03 INPUT-IVR-ALPHA PIC X(10)  VALUE SPACES.

03 INPUT-IVR-ITEM   PIC X(18) VALUE SPACES.

03 INPUT-IVR-DESC   PIC X(30) VALUE SPACES.

03 INPUT-IVR-UM     PIC XXX   VALUE SPACES.

03 INPUT-IVR-TYPE   PIC X     VALUE "S".

03 INPUT-IVR-BILL   PIC X     VALUE SPACES.

03 INPUT-IVR-TAX    PIC X     VALUE "T".

03 INPUT-IVR-SUBSTITUTE          PIC X(18) VALUE SPACES.

03 INPUT-IVR-UPC  PIC X(11) VALUE SPACES.

03 INPUT-IVR-ALTERNATE                      PIC X(18) VALUE
SPACES.

03 INPUT-IVR-ALTERNATE-CODE            PIC X VALUE "0".

03 INPUT-IVR-SEASONAL                       PIC X   VALUE
"N".

03 INPUT-IVR-OBSOLETE                        PIC X   VALUE
"N".

03 INPUT-IVR-VENDOR               PIC X(6)  VALUE SPACES.

03 INPUT-IVR-PURCH-UM                        PIC XXX VALUE
SPACES.

03 INPUT-IVR-TRADE-SERV-ZONE           PIC XXX VALUE SPACES.

03 INPUT-IVR-TRADE-SERV-OPT PIC 9   VALUE 0.

03 INPUT-IVR-PRICING-ITEM PIC X(18) VALUE SPACES.

03 INPUT-IVR-PRICE-REC PIC 99 VALUE 0.

03 INPUT-IVR-LINE-BUY.

05 INPUT-IVR-LB1 PIC X(4) VALUE SPACES.

05 INPUT-IVR-LB2 PIC X(4) VALUE SPACES.

05 INPUT-IVR-LB3 PIC X(4) VALUE SPACES.

05 INPUT-IVR-LB4 PIC X(4) VALUE SPACES.

05 INPUT-IVR-LB5 PIC X(4) VALUE SPACES.

03 FILLER REDEFINES INPUT-IVR-LINE-BUY.

05 INPUT-IVR-LB.

07 INPUT-IVR-LINE OCCURS 5 TIMES PIC X(04).

03 INPUT-IVR-SUPPLY-WARE PIC 99 VALUE 0.

03 INPUT-IVR-PACK-QTY PIC S9(6) VALUE 0.

03 INPUT-IVR-PO-OFF-COST PIC S9V9(6) VALUE 0.

03 INPUT-IVR-DIS-GRP PIC 9(4) VALUE 0.

03 INPUT-IVR-OFF-LIST PIC S9V9(6) VALUE 0.

03 INPUT-IVR-TERMS PIC S99V9  VALUE 0.

03 INPUT-IVR-WEIGHT PIC S9(5)V999  VALUE 0.

03 INPUT-IVR-PROD PIC 9(4) VALUE 9999.

03 INPUT-IVR-COST-LIST PIC S9(5)V999 VALUE 0.

03 INPUT-IVR-MISC-COST PIC S9(5)V999 VALUE 0.

03 INPUT-IVR-YEAR-END-COST PIC S9(5)V999 VALUE 0.

03 INPUT-IVR-LAST-YR-COST PIC S9(5)V999 VALUE 0.

03 INPUT-IVR-LIFO-COST PIC S9(5)V999 VALUE 0.

03 INPUT-IVR-LIFO-POOL PIC 99 VALUE 0.

03 INPUT-IVR-PURCH-PRICE PIC S9(5)V999 VALUE 0.

03 INPUT-IVR-CONV-FACTOR PIC S9(4)V9999 VALUE 0.

03 INPUT-IVR-ADD-DATE-CENT PIC 9(8) VALUE 0.

03 INPUT-IVR-PROMO-START PIC 9(8) VALUE 0.

03 INPUT-IVR-PROMO-END PIC 9(8) VALUE 0.

03 INPUT-IVR-PROMO-PRICE PIC S9(5)V999 VALUE 0.

03 INPUT-IVR-PROMO-COST       PIC S9(5)V999 VALUE 0.

03 INPUT-IVR-ASSORTMENT-CODE PIC X(4) VALUE SPACES.

03 INPUT-IVR-LAST-PRICE-DATE PIC 9(8) VALUE 0.

03 INPUT-IVR-TSD-CREATE-TYPE PIC X VALUE SPACES.

03 INPUT-IVR-VELOCITY-CODE PIC X(5) VALUE SPACES.

03 INPUT-IVR-SERIAL PIC X VALUE SPACES.

03 INPUT-IVR-COMP-LIST PIC X(10) VALUE SPACES.

03 INPUT-IVR-SELL-FLAG PIC 9 VALUE 0.

03 INPUT-IVR-SELL-QTY  PIC 9(6) VALUE 0.

03 INPUT-IVR-TS-COST PIC S9(5)V999 VALUE 0.

03 INPUT-IVR-OFF-LIST2 PIC S9V9(6) VALUE 0.

03 INPUT-IVR-PS-FLAG PIC X VALUE "N".

03 INPUT-IVR-WARRITY-MOS PIC 999 VALUE 0.

03 INPUT-IVR-SEC-TAX PIC X VALUE "E".

03 INPUT-IVR-PURCH-PRICE-FLAG PIC X VALUE "N".

03 INPUT-IVR-SLSM PIC X(4) VALUE SPACES.

03 INPUT-IVR-RETURN PIC X VALUE "Y".

03 INPUT-IVR-SLR-FLAG PIC X VALUE "N".

03 INPUT-IVR-MKT-CODE PIC X VALUE SPACES.

03 INPUT-IVR-LAST-SALE-DATE PIC 9(8)   VALUE 0.

03 INPUT-IVR-FINISH PIC X(20) VALUE SPACES.

03 INPUT-IVR-DIMENSIONS PIC X(30) VALUE SPACES.

03 INPUT-IVR-LAMP1 PIC X(18) VALUE SPACES.

03 INPUT-IVR-LAMP1-QTY PIC 99 VALUE 0.

03 INPUT-IVR-LAMP2 PIC X(18) VALUE SPACES.

03 INPUT-IVR-LAMP2-QTY PIC 99 VALUE 0.

03 INPUT-IVR-LAMP3 PIC X(18) VALUE SPACES.

03 INPUT-IVR-LAMP3-QTY PIC 99 VALUE 0.

03 INPUT-IVR-GRAPHIC-FILE PIC X(30) VALUE SPACES.

03 INPUT-IVR-UPDATE-SOURCE PIC X VALUE "P".

03 INPUT-IVR-EXT-DESC PIC X(90) VALUE SPACES.


Report this thread to moderator Post Follow-up to this message
Old Post
pslitty
06-01-06 11:55 PM


Re: Another Newbie question about text files...
pslitty wrote:
> I have a COBOL question for you.  I am attempting to create a text file
> in which a COBOL program will read it in.  My question is, if I have
> for instance a variable defined as INPUT-IVR-DIS-GRP PIC 9(4) VALUE 0,
> what would I put in the text file to signify no value for this?  Would
> it just be 4 spaces, 4 zeros, 4 9's?  I have about 1% of knowledge in
> COBOL.  The program generating the text file is written in vb.  Thanks
> for any help you can offer.
>
> Here are all the variables that the COBOL program is reading in from
> the text file.

>           03 INPUT-IVR-ITEM-TEMPLATE PIC X(18) VALUE SPACES.
>           03 INPUT-IVR-UNSIGNIED-QTY PIC 9(6) VALUE 0.
>           03 INPUT-IVR-SIGNED-QTY PIC S9(6) VALUE 0.
>
message snipped for brevity

PIC X fields are alphanumeric and any value is acceptable.

PIC 9 fields are numeric and values supplied must be numeric including
leading zeroes.

VALUE clauses have no meaning when reading into a file layout, whatever
is in your text file will be put into the fields whether they be
alphanumeric, numeric or any other format such as internal numeric
formats.  It is up to you to ensure that the fields are filled
correctly, a COBOL program will usually abend/dump when processing a
field specified as numeric when there isn't a valid number in it.

Your numeric fields are USAGE DISPLAY by default.  This means that a
character on the screen for example is exactly what goes in.

A potential problem is when numeric display fields are signed.
Depending on the operating system some form of overpunch in the leading
or trailing digit is used to represent the sign, which usually means
that the screen display for that digit is probably a letter, or special
character for a negative value..  You want to avoid that problem.  To
do so I suggest you use the SIGN IS SEPARATE clause, it can be LEADING
or TRAILING.  The program that creates the data must put the sign in
the preceding or trailing position as appropriate and a purely numeric
value in the rest.

for example:

>           03 INPUT-IVR-SIGNED-QTY PIC S9(6) SIGN IS LEADING SEPARATE.

In this case your text field will/must contain seven characters, one at
the front for the sign and the remaining six for the digits.  I believe
(for at least some compilers) that the sign character can be blank, in
which case it will be assumed to be positive, but it would be better
practice to actually use the + sign for positive values.

Robert


Report this thread to moderator Post Follow-up to this message
Old Post
Robert Jones
06-01-06 11:55 PM


Re: Another Newbie question about text files...
pslitty wrote:
> I have a COBOL question for you.  I am attempting to create a text file
> in which a COBOL program will read it in.  My question is, if I have
> for instance a variable defined as INPUT-IVR-DIS-GRP PIC 9(4) VALUE 0,
> what would I put in the text file to signify no value for this?  Would
> it just be 4 spaces, 4 zeros, 4 9's?

There is no such thing as 'no value'.  The field should have 4 numeric
digits. The program may be doing many things, such as checking for a
numeric value before attempting to process the field. If it does not
check and the field is not numeric then the program may fail. The
program may consider that one specific value means something special,
but you will have to look at the program to determine this.


Report this thread to moderator Post Follow-up to this message
Old Post
Richard
06-01-06 11:55 PM


Re: Another Newbie question about text files...
On 1 Jun 2006 14:17:43 -0700 "Richard" <riplin@Azonic.co.nz> wrote:

:>pslitty wrote:
:>> I have a COBOL question for you.  I am attempting to create a text file
:>> in which a COBOL program will read it in.  My question is, if I have
:>> for instance a variable defined as INPUT-IVR-DIS-GRP PIC 9(4) VALUE 0,
:>> what would I put in the text file to signify no value for this?  Would
:>> it just be 4 spaces, 4 zeros, 4 9's?

:>There is no such thing as 'no value'.  The field should have 4 numeric
:>digits. The program may be doing many things, such as checking for a
:>numeric value before attempting to process the field. If it does not
:>check and the field is not numeric then the program may fail. The
:>program may consider that one specific value means something special,
:>but you will have to look at the program to determine this.

No-value is implementer defined.

It would be hard to make a PIC X no-value as it would require that a certain
value not be valid.

It is quite easy to define a numeric no-value as spaces.

Of course, it is more understandable to carry the no-value status in an
indicator variable.

--
Binyamin Dissen <bdissen@dissensoftware.com>
http://www.dissensoftware.com

Director, Dissen Software, Bar & Grill - Israel


Should you use the mailblocks package and expect a response from me,
you should preauthorize the dissensoftware.com domain.

I very rarely bother responding to challenge/response systems,
especially those from irresponsible companies.

Report this thread to moderator Post Follow-up to this message
Old Post
Binyamin Dissen
06-04-06 11:55 PM


Re: Another Newbie question about text files...
Binyamin Dissen wrote:

> :> If it does not
> :>check and the field is not numeric then the program may fail.

> No-value is implementer defined.

You mean programmer defined. 'Implementor defined' implies the compiler
writer as in the implementation of Cobol.

> It is quite easy to define a numeric no-value as spaces.

For display numerics only.  Seeing a invoice value of $20202.02
indicates that the program was not checking a packed numeric for that,
and binary numerics cannot have any value except valid ones.

My warning (reproduced above) is for numerics where the program does
not check for this special value of a non-numeric.


Report this thread to moderator Post Follow-up to this message
Old Post
Richard
06-04-06 11:55 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Cobol archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 12:41 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.