Help with Data Selection in PIC Field



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

Re: Help with Data Selection in PIC Field

Postby Robert Sample » Fri Jul 30, 2010 11:12 pm

Glad to hear it worked.
Robert Sample
Global moderator
 
Posts: 3367
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 222 times

Re: Re: Help with Data Selection in PIC Field

 

Re: Help with Data Selection in PIC Field

Postby crazycobol » Wed Aug 11, 2010 5:09 am

didn't want to start another thread so I'll ask it in here. Its probably something really simple but I can't seem to understand it.

I am trying to conform to a particular layout. At the end of the data there are spaces filled. I can't get the spaces.

Example:

10 disk-name PIC x(05).
10 disk-address PIC x(10).
10 Filler Pic x(10).


When I have that, it will not give me the 10 spaces.

However if I do the same thing except add a statement at the end such as:

10 disk-name PIC x(05) value spaces.
10 disk-address PIC x(10) value spaces.
10 Filler Pic x(10) value spaces.
10 disk-fill x.


Move "|" to disk-fill.

It will create the spaces. So the data will be

"namesaddresses1 |"

(without the quotation marks)

How do I get it so there are 10 spaces so I don't have to add the extra character.

Thanks for the help
crazycobol
 
Posts: 35
Joined: Fri Dec 04, 2009 3:33 am
Has thanked: 0 time
Been thanked: 0 time

Re: Help with Data Selection in PIC Field

Postby dick scherrer » Wed Aug 11, 2010 6:18 am

Hello,

The spaces have always been there . . .

Moving a | simply made the spaces visable because it put "something" to the right of the 10 spaces.

Why did you think the spaces were not there?
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

Re: Help with Data Selection in PIC Field

Postby Robert Sample » Wed Aug 11, 2010 6:19 am

Your two code segments differ -- the FILLER has VALUE SPACES in one, not in the other.

Is this part of an FD 01 or WORKING-STORAGE variable?

What are you seeing in the FILLER instead of spaces?
Robert Sample
Global moderator
 
Posts: 3367
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 222 times

Re: Help with Data Selection in PIC Field

Postby crazycobol » Wed Aug 11, 2010 9:24 pm

I don't see any spaces if I bring the exported file to a text editor. It has a carriage return.

When I view the file it looks like this:

"namesaddresses1"
"namesaddresses2"
"namesaddresses3"

I would like it to show the spaces:

"namesaddresses1............"
"namesaddresses2............"
"namesaddresses3............"

(the period represent spaces)
crazycobol
 
Posts: 35
Joined: Fri Dec 04, 2009 3:33 am
Has thanked: 0 time
Been thanked: 0 time

Re: Help with Data Selection in PIC Field

Postby NicC » Wed Aug 11, 2010 10:19 pm

If you move to a PC to edit the file then it is quite likely that trailing blanks will be dropped unless you specify that they are to be kept. PC editors use CRLF to detect end of line not LRECL. You have to check it out on the mainframe in ISPF.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 2690
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisys (almost)
Has thanked: 4 times
Been thanked: 105 times

Re: Help with Data Selection in PIC Field

Postby crazycobol » Wed Aug 11, 2010 10:27 pm

how do I go about keeping the trailing blanks? do I insert a CRLF into the file?
crazycobol
 
Posts: 35
Joined: Fri Dec 04, 2009 3:33 am
Has thanked: 0 time
Been thanked: 0 time

Re: Help with Data Selection in PIC Field

Postby Robert Sample » Wed Aug 11, 2010 10:35 pm

If the file is fixed length, every record will be the same length -- if shorter, it will generally be padded to the record length with spaces to the right. Whether or not you see these spaces depends upon which editor you use and what you do to get the file to the editor.

If the file is variable length, the trailing spaces will be there if you put them there. Whether or not you see these spaces depends upon which editor you use and what you do to get the file to the editor.

For example, if you FTP the file from the mainframe to your PC, then open it with a PC editor -- the spaces may not be there anymore since FTP has an option to remove trailing spaces from each record while transferring them. The spaces are still in the file on the mainframe, of course, but you cannot see them due to the way you transferred the file to your editor.
Robert Sample
Global moderator
 
Posts: 3367
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 222 times

Re: Help with Data Selection in PIC Field

Postby crazycobol » Wed Aug 11, 2010 11:27 pm

thanks for the response.

It is a fixed length record. I'm not ftp-ing the file. When the program is creating the file, it is being created on a local drive.
crazycobol
 
Posts: 35
Joined: Fri Dec 04, 2009 3:33 am
Has thanked: 0 time
Been thanked: 0 time

Re: Help with Data Selection in PIC Field

Postby Robert Sample » Wed Aug 11, 2010 11:58 pm

Local drive? Would this, by any chance, be a Micro Focus COBOL compile?
Robert Sample
Global moderator
 
Posts: 3367
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 222 times

PreviousNext

Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post