string delimited by size problem



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

string delimited by size problem

Postby maaike c » Wed Apr 16, 2008 2:48 pm

I wrote the following:

MOVE SPACES                     TO PC-BEH-BERICHT         
                                                   
        perform varying irsz from 1 by 1 until irsz > 10           
          string 'Meerdere polisnummers in PB: '                   
             tabel-rsz-polis (1) ' '                               
             tabel-rsz-polis (2) ' '                               
             tabel-rsz-polis (3) ' '                               
             tabel-rsz-polis (4) ' '                               
             tabel-rsz-polis (5) ' '                               
                                     
             tabel-rsz-polis (6) ' '         
             tabel-rsz-polis (7) ' '         
             tabel-rsz-polis (8) ' '         
             tabel-rsz-polis (9) ' '         
             tabel-rsz-polis (10)             
             delimited by size               
             inTO   PC-BEH-BERICHT           

As a result I get:


'Meerdere polisnummers in PB: ' .........1234567

First I thought the dots wer low-values, but when I ftp the file to our servr they change in unreadable characters which is very annoying.

Does anyone has an idea how I can get rid of the dots?
maaike c
 
Posts: 4
Joined: Wed Apr 16, 2008 2:28 pm
Has thanked: 0 time
Been thanked: 0 time

Re: string delimited by size problem

 

Re: string delimited by size problem

Postby arunprasad.k » Wed Apr 16, 2008 10:15 pm

What does the array tabel-rsz-polis has??

From where do you get this '1234567'??

Try HEX ON and see the values in hexadecimal. X'00' is low-values and if you see anything other than this then you might have to back trace.

Arun.
arunprasad.k
 
Posts: 110
Joined: Thu Dec 27, 2007 5:18 pm
Has thanked: 0 time
Been thanked: 0 time

Re: string delimited by size problem

Postby CICS Guy » Wed Apr 16, 2008 10:23 pm

maaike c wrote:perform varying irsz from 1 by 1 until irsz > 10
What is the point of the perform and where does it terminate?
          string 'Meerdere polisnummers in PB: '                   
             tabel-rsz-polis (1) ' '                               
             tabel-rsz-polis (2) ' '                               
             tabel-rsz-polis (3) ' '                               
             tabel-rsz-polis (4) ' '                               
             tabel-rsz-polis (5) ' '                               
                                     
             tabel-rsz-polis (6) ' '         
             tabel-rsz-polis (7) ' '         
             tabel-rsz-polis (8) ' '         
             tabel-rsz-polis (9) ' '         
             tabel-rsz-polis (10)             
What are the size and values in tabel-rsz-polis (1 through 10)?
As a result I get:
'Meerdere polisnummers in PB: ' .........1234567
How about a hex display of just what those unreadable characters are?
What are the values in tabel-rsz-polis (1 through 10) after the tenth iteration of the perform?
Does anyone has an idea how I can get rid of the dots?
Probably yes, but you must provide more than an incomplete snippet of your code....
CICS Guy
 
Posts: 255
Joined: Wed Jun 20, 2007 4:08 am
Has thanked: 0 time
Been thanked: 0 time

Re: string delimited by size problem

Postby maaike c » Thu Apr 17, 2008 5:51 pm

this is the structure:
  FD PC-BEH                                     
     LABEL RECORDS ARE STANDARD                 
     DATA RECORD IS PC-BEH-ARTIKEL.             
                                                 
 01  PC-BEH-ARTIKEL.                             
     05 PC-BEH-mapij                 PIC X(01). 
     05 PC-BEH-FILLER-1              PIC X(01). 
     05 PC-BEH-BEHEERDER             PIC X(04). 
     05 PC-BEH-FILLER-2              PIC X(01). 
     05 PC-BEH-NR-CONTRACT           PIC X(12). 
     05 PC-BEH-FILLER-3              PIC X(01). 
     05 PC-BEH-DATUM-transfer        PIC X(08). 
     05 PC-BEH-FILLER-4              PIC X(01). 
     05 PC-BEH-INFO                  pic x(21). 
     05 PC-BEH-INFO-r redefines PC-BEH-info.               
        10 PC-BEH-WG-RSZ-NR          PIC X(09).             
        10 PC-BEH-FILLER-5           PIC X(01).             
        10 PC-BEH-WN-RSZ-NR          PIC X(10).             
        10 PC-BEH-FILLER-6           PIC X(01).             
     05 PC-BEH-BERICHT               PIC X(250).   


as you can see, the structure is defined in File section (not in working section) . Somebody told me this is a common problem if you work with QSAM files.You should always initialise the structure each time you fill it with data. With VSAM it would not cause a problem.
Anyway, that is what they told me.
I will now start looking where I have to move SPACES.
Thanks
maaike c
 
Posts: 4
Joined: Wed Apr 16, 2008 2:28 pm
Has thanked: 0 time
Been thanked: 0 time

Re: string delimited by size problem

Postby CICS Guy » Thu Apr 17, 2008 7:35 pm

maaike c wrote:as you can see, the structure is defined in File section (not in working section) . Somebody told me this is a common problem if you work with QSAM files.You should always initialise the structure each time you fill it with data. With VSAM it would not cause a problem.
Anyway, that is what they told me.
I will now start looking where I have to move SPACES.
Thanks
Heck, if you could give any less information, it would be a miracle...
Maybe a moderator will take pity on us and drop this thread into the 'Stupid Questions' bucket.....
CICS Guy
 
Posts: 255
Joined: Wed Jun 20, 2007 4:08 am
Has thanked: 0 time
Been thanked: 0 time

Re: string delimited by size problem

Postby dick scherrer » Thu Apr 17, 2008 10:32 pm

Hello,

Anyway, that is what they told me.
Maybe you need a new they.

Are you simply trying to write an output qsam file?

Is there some reason you decided to use STRING? Moving spaces to PC-BEH-ARTIKEL will initialize the entire area to spaces. . .

Is the output to be a delimited file (otherwise, why is there a fillere between the fields?

You will probably get more usable answers if you post what you want to do rather than code at this point.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post