× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



I just had a brief look at this code and I think you are not using the
'write subfile' command.

The basic operation is

1. Write the CTL with the clear switch on.

2. Write all the records to the subfile.

3 Write the CTL record with the DSPSFL switch on.


----- Original Message -----
From: "Joe Pluta" <joepluta@PlutaBrothers.com>
To: <cobol400-l@midrange.com>
Sent: Saturday, July 27, 2002 2:49 AM
Subject: RE: Subfiles in COBOL


> > From: Jim Essinger
> >
> > Joe,
> >
> > What are you looking for with subfiles and COBOL?
>
> Jim, I'm basically just trying to get one to work.  I think I've figured
out
> most of the pieces, but I'm getting an "incorrect relative record number"
> error.  Relevant bits:
>
> FILE-CONTROL.
>     SELECT WRKSTN ASSIGN TO WORKSTATION-DSPF003
>         ORGANIZATION IS TRANSACTION
>         ACCESS DYNAMIC RELATIVE KEY RRN
>         FILE STATUS IS WS-STATS.
>
> FILE SECTION.
> FD  WRKSTN LABEL RECORDS ARE OMITTED.
> 01  WRKSTN-REC PIC X(1920).
>
> WORKING-STORAGE SECTION.
> 01  WRKSTN-DATA.
>     COPY DDS-ALL-FORMATS OF DSPF003.
> 77  WS-STATS            PIC XX            VALUE ZERO.
> 77  RRN                 PIC 9(2)          VALUE ZERO.
>
> 01  INDIC-AREA.
>     05  IN03            PIC 1.
>         88  CF3                           VALUE B"1".
>     05  IN50            PIC 1.
>         88  CLEAR-SUBFILE                 VALUE B"1".
>         88  DISPLAY-SUBFILE               VALUE B"0".
>
> INIT-SUBFILE.
>     SET CLEAR-SUBFILE TO TRUE
>     MOVE CORR INDIC-AREA TO CTL-O-INDIC
>     WRITE WRKSTN-REC FROM CTL-O FORMAT "CTL"
>     SET DISPLAY-SUBFILE TO TRUE
>     MOVE CORR INDIC-AREA TO CTL-O-INDIC
>     MOVE 0 TO RRN.
>     PERFORM WRITE-SUBFILE THROUGH WRITE-SUBFILE-END
>        UNTIL RRN > 4.
> INIT-SUBFILE-END.
>
> WRITE-SUBFILE.
>     ADD 1 TO RRN.
>     WRITE WRKSTN-REC FROM SFL-O FORMAT "SFL".
> WRITE-SUBFILE-END.
>
>
> As you can see, I'm just trying to write out a few records to the subfile.
> The DDS is minimal:
>
>
> A                                      DSPSIZ(24 80 *DS3)
> A                                      CF03(03)
> A          R SFL                       SFL
> A            AMOUNT         3S 0B  6 36
> A            TOTAL          4Y 0O  6 42EDTCDE(L)
> A          R CTL                       SFLCTL(SFL)
> A                                      OVERLAY
> A                                      SFLSIZ(0015)
> A                                      SFLPAG(0014)
> A N50 51                               SFLDSP
> A N50                                  SFLDSPCTL
> A  50                                  SFLCLR
> A                                  1  2DATE
> A                                      EDTCDE(Y)
> A                                  1 32'PSC/400 COBOL Test'
> A                                      DSPATR(HI)
> A            PGMNAM        10A  O  1 68
> A                                  2  2TIME
> A                                  2 34'Subfile Test 1'
> A                                      COLOR(YLW)
> A                                  2 68USER
> A                                  5 35'Amount'
> A                                      DSPATR(HI)
> A                                  5 42'Total'
> A                                      DSPATR(HI)
>
>
> I added indicator 51 to the SFLDSP keyword, and at least the control
record
> comes up.  Originally it was only conditioned with N50, and I got a nasty
> MCH1202 error, which was most likely due to not writing any records to the
> subfile.  I put the indicator 51 in, and now at least the subfile control
> comes up correctly, but when I check the joblog, I see a whole slew of
> CPF5021 "Incorrect relative record number or field selection error"
errors.
> Checking the value of the field RRN just prior to the WRITE, it looks
fine,
> cycling from 1 to 5 as I would expect.
>
> So, somehow I'm not properly identifying the current relative record
number
> to the subfile.  I thought the RELATIVE KEY clause did that, but evidently
> I'm not doing something correctly.  I've tried various sizes for the RRN
> field, by the way, including PIC 9(2), PIC 9(4) and even PIC 999 COMP.
All
> fail miserably.
>
> Joe
>
>
> > From: Jim Essinger
> >
> > Joe,
> >
> > What are you looking for with subfiles and COBOL?
>
> _______________________________________________
> This is the COBOL Programming on the iSeries/AS400 (COBOL400-L) mailing
list
> To post a message email: COBOL400-L@midrange.com
> To subscribe, unsubscribe, or change list options,
> visit: http://lists.midrange.com/cgi-bin/listinfo/cobol400-l
> or email: COBOL400-L-request@midrange.com
> Before posting, please take a moment to review the archives
> at http://archive.midrange.com/cobol400-l.
>
>



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.