Re: Productivity




"Rick Smith" <ricksmith@xxxxxxx> wrote in message
news:12pdftt926l3sb9@xxxxxxxxxxxxxxxxxxxxx

"Pete Dashwood" <dashwood@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:4vm6ldF16ggd7U1@xxxxxxxxxxxxxxxxxxxxx
[snip]
01 IN-DATA.
12 FILLER PIC X(50) VALUE
"userId=FJS¦location=AURO¦function=filmRequest¦acct".
12 FILLER PIC X(50) VALUE
"Number=1234567890¦userExtension=1403¦routing=branc".
12 FILLER PIC X(50) VALUE
"h¦routeLoc=K-MISS¦routeAttn=Joe¦comments=Comments ".
12 FILLER PIC X(50) VALUE
"Go Here¦debit¦date=121306¦amount=100.00¦sequenceNb".
12 FILLER PIC X(50) VALUE
"r=12345678¦¦credit¦date=051406¦amount=900.00¦seque".
12 FILLER PIC X(50) VALUE
"nceNbr=11122233¦¦ATM¦date=010106¦amount=123.45¦¦ch".
12 FILLER PIC X(50) VALUE
"argeback¦date=010106¦amount=500.00¦¦statement¦date".
12 FILLER PIC X(50) VALUE
"=032906¦amount=1000.00¦ ".
01 INPUT-DATA REDEFINES IN-DATA PIC X(400).

Just an observation; but it seems easier to me,
when populating a large data item, to use the
STRING statement. For example, ...

move spaces to input-data
string
"userId=FJS¦location=AURO¦function=filmRequest¦acct"
"Number=1234567890¦userExtension=1403¦routing=branc"
"h¦routeLoc=K-MISS¦routeAttn=Joe¦comments=Comments "
"Go Here¦debit¦date=121306¦amount=100.00¦sequenceNb"
"r=12345678¦¦credit¦date=051406¦amount=900.00¦seque"
"nceNbr=11122233¦¦ATM¦date=010106¦amount=123.45¦¦ch"
"argeback¦date=010106¦amount=500.00¦¦statement¦date"
"=032906¦amount=1000.00¦"
delimited by size
into input-data.

And, multiple STRING statements allow
for multiple tests.

Furthermore, binary values may be inserted
by using hex literals (non-ANS 85). For example, ...

move spaces to cr-lf-separated-data
string
"abc" x"0d0a" "def" x"0d0a" "ghi" x"0d0a"
delimited by size
into cr-lf-separated-data.

All this with no messy counting!


Yes, that's a good point.

Over the years (starting from before STRING was available) I tried many ways
to insert long strings into COBOL programs. I'm sure most COBOL programmers
have encountered the same problem. Continuation is ugly and not simple; most
other definitions require counting as you point out, and that is also messy
and error prone.

I tried concatenation (similar to what you would do in VB) and that worked
OK but left me vaguely dissatisfied :-).

The above is as easy as I could make it on myself inasmuch as it is clear
and you don't need to count. (Just take X columns from wherever you start...
if it starts in 13 and you have defined X to be 50, it must end in 62, start
+ X - 1).

The Fujitsu IDE I use to write COBOL shows line and column for wherever you
put the cursor, so this is pretty simple. After doing the first one and
checking it, it is a simple matter to copy this and insert the rest.

Your point about hex literals is well taken, and for this it would certainly
be necessary to either concatenate or use STRING.

Pete.


.



Relevant Pages

  • Re: Finding a string literal in a *PGM object
    ... As I said in my first post, I am looking for a specific string that is ... coded as follows in all of our COBOL programs: ... My next problem is how to parse it reasonably ... to parse one in REXX. ...
    (comp.sys.ibm.as400.misc)
  • Re: syntax...
    ... B&D on the part of the language designer. ... probably handle concatenation of string literals by itself, ... bitwise XOR, or if not that, then exponentiation.) ...
    (comp.lang.misc)
  • Bugs in the Module::Dependency
    ... Manifying blib/man1/pmd_indexer.plx.1 ... Use of uninitialized value in concatenation or string at ... # Failed test in t/04grapher.t at line 81. ...
    (perl.dbi.users)
  • RE: Simple regex problem has me baffled
    ... I am writing a script to analyse a log file. ... Each pair of Request and Response calls have a unique ... Use of uninitialized value in concatenation or string at ...
    (perl.beginners)
  • Re: Literal concatenation, strings vs. numbers (was: Numeric literals in other than base 10 - wa
    ... Well my take on it is that this would not be the same as string ... concatenation, the series of digits would be parsed as a single token ... digit separation can superficially resemble string concatenation if ... I would favor _ as a digit separator in Python ...
    (comp.lang.python)