Page 3 of 3

Re: Help with Data Selection in PIC Field

PostPosted: Thu Aug 12, 2010 12:01 am
by dick scherrer
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). . .

Re: Help with Data Selection in PIC Field

PostPosted: Thu Aug 12, 2010 3:36 am
by crazycobol
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.

Re: Help with Data Selection in PIC Field

PostPosted: Thu Aug 12, 2010 4:47 am
by Robert Sample
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.

Re: Help with Data Selection in PIC Field

PostPosted: Thu Sep 23, 2010 10:00 pm
by uday@
tell me the process?????

Re: Help with Data Selection in PIC Field

PostPosted: Thu Sep 23, 2010 11:28 pm
by dick scherrer
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?

Re: Help with Data Selection in PIC Field

PostPosted: Thu Apr 14, 2011 6:42 pm
by Mohammed Umar
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

Re: Help with Data Selection in PIC Field

PostPosted: Thu Apr 14, 2011 6:53 pm
by Robert Sample
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

Re: Help with Data Selection in PIC Field

PostPosted: Fri Apr 15, 2011 5:29 pm
by Mohammed Umar
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

Re: Help with Data Selection in PIC Field

PostPosted: Fri Apr 15, 2011 5:48 pm
by Robert Sample
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.