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 dick scherrer » Thu Aug 12, 2010 12:01 am

Hello,

This is a mainframe cobol forum - not a pc cobol forum.

Suggest you read the pc cobol manual for the ways to define the output to preserve trailing spaces. On unix and win-based systems it is more common to eliminate trailing spaces (at least with the environments i've worked in). . .
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: Re: Help with Data Selection in PIC Field

 

Re: Help with Data Selection in PIC Field

Postby crazycobol » Thu Aug 12, 2010 3:36 am

Robert Sample wrote:Local drive? Would this, by any chance, be a Micro Focus COBOL compile?


yes it is being compile by Micro Focus Cobol.
       ENVIRONMENT DIVISION.
       CONFIGURATION SECTION.

       SOURCE-COMPUTER. COMPAQ-PC.
       OBJECT-COMPUTER. COMPAQ-PC.

       INPUT-OUTPUT SECTION.
       FILE-CONTROL.

           SELECT MSTRFILE     ASSIGN TO DISK      WS-ADDRESS-MSTR
               ORGANIZATION    IS INDEXED
               ACCESS MODE     IS SEQUENTIAL
               STATUS          IS FILE-LOCK
               LOCK MODE       IS MANUAL
               RECORD KEY      IS MSSN
               ALTERNATE RECORD KEY IS MLNAME  WITH DUPLICATES.

           SELECT DEPNFILE      ASSIGN TO DISK      WS-ADDRESS-DEPN
               ORGANIZATION    IS INDEXED
               ACCESS MODE     IS DYNAMIC
               STATUS          IS FILE-LOCK
               LOCK MODE       IS MANUAL
               RECORD KEY      IS NKEY
               ALTERNATE RECORD KEY IS NLNAME  WITH DUPLICATES.

           SELECT DISKOUT      ASSIGN TO DISK      WS-ADDRESS-OUT-DSK
                               STATUS IS FILE-LOCK
                               ORGANIZATION LINE SEQUENTIAL.
        DATA DIVISION.
       FILE SECTION.

           COPY "N:\MSTRFILE.LIB".

           COPY "N:\DEPNFILE.LIB".

       FD  DISKOUT
           LABEL RECORDS ARE STANDARD.
       01  DISKOUT-REC                 PIC  X(600).

       01  DISKREC-EE.
           05  DISK-EE-GEN             PIC  X(03) VALUE SPACE.
           05  DISK-EE-TYPE            PIC  X(01) VALUE SPACE.
           05  DISK-EE-CONTROL         PIC  X(05) VALUE SPACE.
           05  DISK-EE-SUBSCRIBER-ID   PIC  X(30) VALUE SPACE.
           05  DISK-EE-SSN             PIC  9(09).
           05  FILLER                  PIC  X(30) VALUE SPACE.
           05  FILLER                  PIC  X(30) VALUE SPACE.
           05  FILLER                  PIC  X(09) VALUE SPACE.
           05  DISK-EE-LNAME           PIC  X(18) VALUE SPACE.
           05  DISK-EE-FNAME           PIC  X(12) VALUE SPACE.
           05  FILLER                  PIC  X(04) VALUE SPACE.
           05  DISK-EE-SEX             PIC  X(01) VALUE SPACE.
           05  DISK-EE-COVERAGE        PIC  X(01) VALUE SPACE.
           05  DISK-EE-BIRTH           PIC  9(08).
           05  DISK-EE-EFFECT          PIC  9(08).
           05  DISK-EE-TERM            PIC  9(08).
           05  FILLER                  PIC  X(08) VALUE SPACE.
           05  DISK-EE-DIVISION        PIC  X(30) VALUE SPACE.
           05  DISK-EE-CROSS-REF-1     PIC  X(16) VALUE SPACE.
           05  DISK-EE-ADD1            PIC  X(30) VALUE SPACE.
           05  DISK-EE-ADD2            PIC  X(30) VALUE SPACE.
           05  DISK-EE-CITY            PIC  X(19) VALUE SPACE.
           05  DISK-EE-STATE           PIC  X(02) VALUE SPACE.
           05  DISK-EE-ZIP             PIC  X(10) VALUE SPACE.
           05  DISK-EE-PHONE           PIC  X(10) VALUE SPACE.
           05  DISK-EE-COUNTRY         PIC  X(03) VALUE SPACE.
           05  FILLER                  PIC  X(265) VALUE SPACES.

       01  WS-ADDRESS-OUT-DSK.
           05  FILLER                   PIC  X(03) VALUE "N:\".
           05  FILLER                   PIC  X(06) VALUE "TESTIN".
           05  FILLER                   PIC  X(04) VALUE ".DAT".



It takes the Diskrec-ee and write it to diskout. If its not something simple then I will just have to include a field at the end so that spaces are filled in-between. Thank you all for the response so far. It is much appreciated.
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 » Thu Aug 12, 2010 4:47 am

I know, from past experience with Micro Focus COBOL, that it has an option to allow trailing spaces to be removed -- or retained -- and it sounds like you may have the option specified incorrectly for what you want. I don't remember the details of the option, but I'm sure if you go through the documentation on compiler and run-time options you'll find it quickly enough.
Robert Sample
Global moderator
 
Posts: 3367
Joined: Sat Dec 19, 2009 8:32 pm
Location: East Dubuque, Illinois
Has thanked: 1 time
Been thanked: 222 times

Re: Help with Data Selection in PIC Field

Postby uday@ » Thu Sep 23, 2010 10:00 pm

tell me the process?????
uday@
 
Posts: 1
Joined: Thu Sep 23, 2010 9:10 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Help with Data Selection in PIC Field

Postby dick scherrer » Thu Sep 23, 2010 11:28 pm

Hello and welcome to the forum,

If you intend to work in IT and participate in technical forums, you need to learn how "things are done". . . One needs to provide a meaningful topic/subject, post in the proper part of the forum (starting a new topic for a new question), and provide enough information that someone can help.

Your complete lack of specifics makes any meaningful answer impossible. . .

What "process"?

Does this in any way relate to the topic you posted a reply to?
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 Mohammed Umar » Thu Apr 14, 2011 6:42 pm

Hi Robert,

I saw your comment which u made on wed Aug 11,2010.
"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."


To obtain spaces in my local what has to be done. I am able to see spaces in mainframe but not in my local.

Thanks in advance
Mohammed umar
Mohammed Umar
 
Posts: 3
Joined: Thu Apr 14, 2011 6:35 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Help with Data Selection in PIC Field

Postby Robert Sample » Thu Apr 14, 2011 6:53 pm

If the FTP is done from the mainframe side, use
//SYSFTPD DD *
TRAILINGBLANKS FALSE
/*
as part of your JCL.

If the FTP is done from the PC, use this command BEFORE doing the GET:
quote site trailingblanks
Robert Sample
Global moderator
 
Posts: 3367
Joined: Sat Dec 19, 2009 8:32 pm
Location: East Dubuque, Illinois
Has thanked: 1 time
Been thanked: 222 times

Re: Help with Data Selection in PIC Field

Postby Mohammed Umar » Fri Apr 15, 2011 5:29 pm

Hi Robert,

Actually the file flow is like this Mainframe ---> FTP ---> Unix server.
In mainframe there are spaces but not in Unix server.

Is the problem is from mainframe to FTP? or FTP to Unix server?

As you said, i tried "quote site trailingblanks" before GET. It says "504 SITE unknown type".

thanks
umar
Mohammed Umar
 
Posts: 3
Joined: Thu Apr 14, 2011 6:35 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Help with Data Selection in PIC Field

Postby Robert Sample » Fri Apr 15, 2011 5:48 pm

If the mainframe is initiating the FTP, the command would be
quote locsite trailingblanks

Something else to consider is that Unix files are not record-oriented; the line termination character ends a text line. If you transfer this file to a mainframe file with RECFM=FB, and the line on the Unix server is shorter than the record length, it will be padded with spaces at the end to meet the fixed length record requirement. If this is the case, you either live with the trailing spaces or you change the mainframe file from RECFM=FB to RECFM=VB, adding 4 to the LRECL, so the records are picked up at the length they are on the Unix server.
Robert Sample
Global moderator
 
Posts: 3367
Joined: Sat Dec 19, 2009 8:32 pm
Location: East Dubuque, Illinois
Has thanked: 1 time
Been thanked: 222 times

Previous

Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post