Simple coding problem 
Author Message
 Simple coding problem

I'm  a new student in COBOL but am having a hard time UNSTRINGing in a
sort program. If you use the unstring verb within the output procedure
module does that neccesitate defining input and output file fields in
working storage? Maybe a really simple example of  unstring code would
help. Any takers? Many thanks to anyone who responds.



Tue, 26 Sep 2000 03:00:00 GMT  
 Simple coding problem

Peter,

This is from memory so be warned.

lets say your getting a field in the record that has the city state
zip in it.  Lets call the field CITY-STATE-ZIP.  An example of it
would be:
    CHICAGO ILL 60005

Then in working storage, have three fields called
   01 CITY        PIC X(25).
   01 STATE     PIC X(3).
   01 ZIP           PIC X(10).

Then the unstring command would look like:

    UNSTRING CITY-STATE-ZIP DELIMITED BY SPACE INTO
         CITY
         STATE
         ZIP.

I think that should do it. (I Hope)

Paul

Quote:

>I'm  a new student in COBOL but am having a hard time UNSTRINGing in a
>sort program. If you use the unstring verb within the output procedure
>module does that neccesitate defining input and output file fields in
>working storage? Maybe a really simple example of  unstring code would
>help. Any takers? Many thanks to anyone who responds.



Tue, 26 Sep 2000 03:00:00 GMT  
 Simple coding problem

Quote:

> lets say your getting a field in the record that has the city state
> zip in it.  Lets call the field CITY-STATE-ZIP.  An example of it
> would be:
>     CHICAGO ILL 60005
>     UNSTRING CITY-STATE-ZIP DELIMITED BY SPACE INTO
>          CITY
>          STATE
>          ZIP.

What if the string is "LOS ANGELES CA 90001"?

--
I  |\   Randall Bart

o  |\   1-310-542-6013                       Please reply without spam
v  | \  Cancer victim/Medical {*filter*} activist Todd McCormick jailed
e    |\ for using Marinol w/ prescription: http://www.*-*-*.com/ {*filter*}.org
Y    |/        http://{*filter*}magazine.com/toc/articles/toddheld.html
o    |\ Panic in the Year Zero Zero:   http://www.*-*-*.com/ ;
u    |/ Is it easy yet?: http://www.*-*-*.com/



Tue, 26 Sep 2000 03:00:00 GMT  
 Simple coding problem

Quote:


> > lets say your getting a field in the record that has the city state
> > zip in it.  Lets call the field CITY-STATE-ZIP.  An example of it
> > would be:
> >     CHICAGO ILL 60005

> >     UNSTRING CITY-STATE-ZIP DELIMITED BY SPACE INTO
> >          CITY
> >          STATE
> >          ZIP.

> What if the string is "LOS ANGELES CA 90001"?

Very good point, don't forget "New York, New York 10014-4342", or "San
Luis Obispo, CA 91111". He doesn't say if CITY-STATE-ZIP contains only
valid state abbreviations, or not. If true, it would help determine
what's what. I suspect that the instructor might toss in several forms
of city and state to make things interesting and to show the pitfalls of
jumping to conclusions. Is it a given that the CITY-STATE-ZIP is a US
address?

Bill {*filter*}

- Show quoted text -

Quote:
> --
> I  |\   Randall Bart

> o  |\   1-310-542-6013                       Please reply without spam
> v  | \  Cancer victim/Medical {*filter*} activist Todd McCormick jailed
> e    |\ for using Marinol w/ prescription: http://www.*-*-*.com/ {*filter*}.org
> Y    |/        http://{*filter*}magazine.com/toc/articles/toddheld.html
> o    |\ Panic in the Year Zero Zero:   http://www.*-*-*.com/
> u    |/ Is it easy yet?: http://www.*-*-*.com/



Wed, 27 Sep 2000 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Simple code problem

2. A simple code problem (from me too)

3. Problems with simple code.

4. Problem with a piece of code (probably a simple one)

5. Simple problem, simple solution.

6. problems converting unix code to linux code (direct access files)

7. Problem converting f90-code to f95-code

8. A problem when using SWIG to integrate C code into TCL code

9. odd cond codes from simple assembler program

10. Simplest way to call some C code

11. simple code in rbscript crashes under win32?

12. Help with (I thot) simple code

 

 
Powered by phpBB® Forum Software