ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Error attempt to write duplicate records into subfile

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Error attempt to write duplicate records into subfile

    I got this error when I do write subfile in rpgle program.
    But I do use physical file without key.
    How would this still happen?


    Code:
    Fprcclst   uf a e             disk                      
    Fprc01d    cf   e             workstn indds(IndDs)      
    F                                     sfile(#sflrcd:rrn)
    F*                                                      
    DIndDs            DS                                    
    Dsflctldsp               30     30n                     
    Dsfldsp                  31     31n                     
    Dsflclr                  32     32n                     
    Dsflend                  33     33n                     
    D*                                        
    C                   eval      sfldsp=*off                         
    C                   eval      sflclr=*on                          
    C                   write     #sflctl                             
    C                   eval      sflctldsp=*on                       
    C                   eval      sflclr=*off                         
    C                   z-add     0             rrn               4 0 
    C                   eval      savrrn=1                            
    C                   eval      sflend=*off                         
    C                   if        rrn > 0      
    C                   eval      sfldsp=*on   
    C                   else                   
    C                   eval      sfldsp=*off  
    C     'norecords'   dsply                  
    C                   endif                  
                    
    C     *start        setll     prcclst      
    C                   read      prcclst      
    C                   dow       not %eof     
    C                   eval      rrn+=1       
    C     rrn           chain     prcclst      
    C                   eval      opt#=*blanks 
    C                   write     #sflrcd      
    C                   read      prcclst      
    C                   enddo                  
    C                   write     #sflrcd      
     C                   exfmt     #sflctl   
     C                   eval      *inlr=*on 
     ****************** End of data *********

  • #2
    Re: Error attempt to write duplicate records into subfile

    The error is not about your non keyed table.
    its about the subfile not being cleared and you loading the Relative record number "again"

    you can grab the RRN and store this as a hidden field so you can chain back to update/delete records in the table.
    -- or -- you could use sql to sort and subset the records. I believe this to be a better solution.


    Jamie
    All my answers were extracted from the "Big Dummy's Guide to the As400"
    and I take no responsibility for any of them.

    www.code400.com

    Comment


    • #3
      Re: Error attempt to write duplicate records into subfile

      First of all thanks for your reply.
      But I don't understand because I did clear subfile with sflclr=*on
      I did have hidden field savrrn in DDS. Do you mean I have to code eval savrrn = rrn?
      I'm newbie and I think I need to go through some reference materials to know more.
      Else I don't think I understand.
      Can you suggest some?

      Comment


      • #4
        Re: Error attempt to write duplicate records into subfile

        you are going to have to place this bad boy in debug and walk thru it.

        If you post a save file with the table, the display and this code -- I will take a look.
        I'm too old and don't have the time to rekey all this.. Last time I tried I broke a hip..
        All my answers were extracted from the "Big Dummy's Guide to the As400"
        and I take no responsibility for any of them.

        www.code400.com

        Comment


        • #5
          Re: Error attempt to write duplicate records into subfile

          I attached a save file with table, DDS and code.
          Thanks in advance.

          BTW, could you suggest reference material so that I can know better with rpgle subfile?
          Thanks again.
          Attached Files

          Comment


          • #6
            Re: Error attempt to write duplicate records into subfile

            Got the text file .. this is not what we would call a save file.
            are you familiar with the IBMi command ...
            Code:
            CRTSAVF
            don't worry about attaching an IBMi savf -- I will do that for you.

            I also noticed that you are on V5R3 -- this is important to tell as there have been many enhancements to the IBMi since that release.


            so reference material




            Thank you
            Jamie
            All my answers were extracted from the "Big Dummy's Guide to the As400"
            and I take no responsibility for any of them.

            www.code400.com

            Comment


            • #7
              Re: Error attempt to write duplicate records into subfile

              also your indicators on the subfile don't match your indicators on your data structure in the RPG.
              so you are NOT clearing the subfile
              All my answers were extracted from the "Big Dummy's Guide to the As400"
              and I take no responsibility for any of them.

              www.code400.com

              Comment


              • #8
                Re: Error attempt to write duplicate records into subfile

                source(es) -- I have added and changed some stuff for future education.

                Display: EXAMPLED
                PHP Code:
                     A*%%TS  SD  20141206  202949  JAMIE       REL-V5R3M0  5722-WDS                                 
                     A
                *%%EC                                                                                         
                     A                                      DSPSIZ
                (24 80 *DS3)                                      
                     
                A                                      PRINT                                                   
                     
                A                                      INDARA                                                  
                     A                                      CF01                                                    
                     A                                      CF02                                                    
                     A                                      CF03                                                    
                     A                                      CF04                                                    
                     A                                      CF05                                                    
                     A                                      CF06                                                    
                     A                                      CF07                                                    
                     A                                      CF08                                                    
                     A                                      CF09                                                    
                     A                                      CF10                                                    
                     A                                      CF11                                                    
                     A                                      CF12                                                    
                     A                                      CF13                                                    
                     A                                      CF14                                                    
                     A                                      CF15                                                    
                     A                                      CF16                                                    
                     A                                      CF17                                                    
                     A                                      CF18                                                    
                     A                                      CF19                                                    
                     A                                      CF20                                                    
                     A                                      CF21                                                    
                     A                                      CF22                                                    
                     A                                      CF23                                                    
                     A                                      CF24                                                    
                     A                                      PAGEDOWN                                                
                     A                                      PAGEUP                                                  
                     A
                **************************************************************************                    
                     
                A*  Subfile number one                                                                         
                     A
                **************************************************************************                    
                     
                A          R SUB01                     SFL                                                     
                     A
                *%%TS  SD  20141206  202949  JAMIE       REL-V5R3M0  5722-WDS                                 
                     A            OPT
                #           1A  B 10  5                                                        
                     
                A            CODE           2A  O 10 10                                                        
                     A            DESC          60A  O 10 15                                                        
                     A
                **************************************************************************                    
                     
                A*  Control for subfile number one                                                             
                     A
                **************************************************************************                    
                     
                A          R SUB01CTL                  SFLCTL(SUB01)                                           
                     
                A*%%TS  SD  20141206  202949  JAMIE       REL-V5R3M0  5722-WDS                                 
                     A                                      SFLSIZ
                (0011)                                            
                     
                A                                      SFLPAG(0010)                                            
                     
                A                                      RTNCSRLOC(&#REC &#FLD)                                  
                     
                A                                      BLINK                                                   
                     A                                      OVERLAY                                                 
                     A                                      SFLCSRRRN
                (&WHERE)                                       
                     
                A  52                                  SFLDSP                                                  
                     A  51                                  SFLDSPCTL                                               
                     A  50                                  SFLCLR                                                  
                     A  45                                  SFLEND
                (*MORE)                                           
                     
                A            SCRRN          4S 0H      SFLRCDNBR                                               
                     A                                  1  3DATE                                                    
                     A                                      EDTCDE
                (Y)                                               
                     
                A                                      COLOR(BLU)                                              
                     
                A                                  1 12TIME                                                    
                     A                                      COLOR
                (BLU)                                              
                     
                A            ATR_DACONM     1A  P                                                              
                     A            COMPANY       30A  O  1 26DSPATR
                (&ATR_DACONM)                                     
                     
                A                                      DSPATR(HI)                                              
                     
                A            HDPROGRAM     10A  O  1 70COLOR(PNK)                                              
                     
                A            C1TITLE       40A  O  2 21DSPATR(&ATR_DACONM)                                     
                     
                A                                      DSPATR(HI)                                              
                     
                A N70                              6  3'Type options, press Enter.'                            
                     
                A                                      COLOR(BLU)                                              
                     
                A                                  7  5'2=Edit'                                                
                     
                A                                      COLOR(BLU)                                              
                     
                A                                  9 15'Description'                                           
                     
                A                                      DSPATR(HI)                                              
                     
                A                                      DSPATR(UL)                                              
                     
                A                                  9  4'Opt'                                                   
                     
                A                                      DSPATR(HI)                                              
                     
                A                                      DSPATR(UL)                                              
                     
                A            #REC          10A  H                                                              
                     
                A            #FLD          10A  H                                                              
                     
                A            WHERE          5S 0H                                                              
                     A                                  9  9
                'Code'                                                  
                     
                A                                      DSPATR(HI)                                              
                     
                A                                      DSPATR(UL)                                              
                     
                A                                  7 14'3=Copy'                                                
                     
                A                                      COLOR(BLU)                                              
                     
                A                                  7 23'4=Delete'                                              
                     
                A                                      COLOR(BLU)                                              
                     
                A                                  7 34'5=View'                                                
                     
                A                                      COLOR(BLU)                                              
                     
                A**************************************************************************                    
                     
                A*  Function Keys(02)    Show all unrouted Production Orders                                   
                     A
                **************************************************************************                    
                     
                A          R FKEY01                                                                            
                     A
                *%%TS  SD  20070726  130753  FLANARY     REL-V5R4M0  5722-WDS                                 
                     A                                 22  3
                'F3=Exit'                                               
                     
                A                                      COLOR(BLU)                                              
                     
                A**************************************************************************                    
                     
                AMessage subfile stuff.                                                                      
                     
                A**************************************************************************                    
                     
                A          R MSGSFL                                                                            
                     A                                      SFL                                                     
                     A                                      SFLMSGRCD
                (24)                                           
                     
                A            MSGKEY                    SFLMSGKEY                                               
                     A            PGMQ                      SFLPGMQ
                (10)                                             
                     
                A**************************************************************************                    
                     
                AMessage subfile stuff                                                                       
                     A
                **************************************************************************                    
                     
                A          R MSGCTL                                                                            
                     A                                      SFLCTL
                (MSGSFL)                                          
                     
                A                                      OVERLAY                                                 
                     A                                      SFLDSP                                                  
                     A                                      SFLDSPCTL                                               
                     A                                      SFLINZ                                                  
                     A N03                                  SFLEND                                                  
                     A                                      SFLSIZ
                (2)                                               
                     
                A                                      SFLPAG(1)                                               
                     
                A            PGMQ                      SFLPGMQ(10)                                             
                     
                A**************************************************************************                    
                     
                A          R DUMMY                                                                             
                     A                                      ASSUME                                                  
                     A                                  1  3
                ' ' 
                Program: EXAMPLER
                PHP Code:
                     H dftactgrp( *no OPTION(*NODEBUGIO)                                                          
                      *                                                                                             
                     
                fexampled  cf   e             workstn INFDS(INFDS)                                             
                     
                f                                     SFILE(SUB01:RRN1)                                        
                     
                fprcclst   if   e           k disk                                                             
                      
                *                                                                                             
                      *  
                entry plist                                                                                
                      
                *                                                                                             
                     
                d EXAMPLER        pr                                                                           
                     d  incode                        2    
                const options( *nopass )                                 
                                                                                                                    
                     
                d EXAMPLER        pi                                                                           
                     d  incode                        2    
                const options( *nopass )                                 
                      *                                                                                             
                      * 
                Variable Definition                                                                         
                      
                *                                                                                             
                     
                d count           s              4  0                                                          
                     d EndScreen1      s               n   inz
                ('0')                                                 
                     
                d LenStr          s              4  0                                                          
                     d messagecsc      s             10i 0                                                          
                     d messagedata     s             80A                                                            
                     d messagekey      s              4A                                                            
                     d messagelen      s             10i 0                                                          
                     d messagefile     s             20    inz
                ('QCPFMSG   *LIBL')                                   
                     
                d messageid       s              7                                                             
                     d reloadsub01     s               n                                                            
                     d RRN1            s                   like
                (SCRRN)                                              
                     
                d Savrrn          s                   like(SCRRN)                                              
                     
                d screenerror     s               n   inz('0')                                                 
                     
                d workcompany     s             30                                                             
                     d workTitle       s             40                                                             
                      
                //                                                                                            
                      // Program Info                                                                               
                      //                                                                                            
                     
                d                SDS                                                                           
                     d  
                @PGM                 001    010                                                             
                     d  
                @PARMS               037    039  0                                                          
                     d  
                @MSGDTA               91    170                                                             
                     d  
                @MSGID               171    174                                                             
                     d  
                @JOB                 244    253                                                             
                     d  
                @USER                254    263                                                             
                     d  
                @JOB#                264    269  0                                                          
                                                                                                                    
                      // Command Keys                                                                               
                                                                                                                    
                     
                d Cmd01           c                   const(x'31')                         Cmd-1               
                     d Cmd02           c                   
                const(x'32')                         Cmd-2               
                     d LeaveProgram    c                   
                const(x'33')                         Cmd-3               
                     d Cmd04           c                   
                const(x'34')                         Cmd-4               
                     d Cmd05           c                   
                const(x'35')                         Cmd-5               
                     d Cmd06           c                   
                const(x'36')                         Cmd-6               
                     d Cmd07           c                   
                const(x'37')                         Cmd-7               
                     d Cmd08           c                   
                const(x'38')                         Cmd-8               
                     d Cmd09           c                   
                const(x'39')                         Cmd-9               
                     d Cmd10           c                   
                const(x'3A')                         Cmd-10              
                     d Cmd11           c                   
                const(x'3B')                         Cmd-11              
                     d Cmd12           c                   
                const(x'3C')                         Cmd-12              
                     d Cmd13           c                   
                const(x'B1')                         Cmd-13              
                     d Cmd14           c                   
                const(x'B2')                         Cmd-14              
                     d Cmd15           c                   
                const(x'B3')                         Cmd-15              
                     d Cmd16           c                   
                const(x'B4')                         Cmd-16              
                     d Cmd17           c                   
                const(x'B5')                         Cmd-17              
                     d Cmd18           c                   
                const(x'B6')                         Cmd-18              
                     d Cmd19           c                   
                const(x'B7')                         Cmd-19              
                     d Cmd20           c                   
                const(x'B8')                         Cmd-20              
                     d Cmd21           c                   
                const(x'B9')                         Cmd-21              
                     d Cmd22           c                   
                const(x'BA')                         Cmd-22              
                     d Cmd23           c                   
                const(x'BB')                         Cmd-23              
                     d Cmd24           c                   
                const(x'BC')                         Cmd-24              
                     d EnterKey        c                   
                const(x'F1')                                             
                     
                d RollUp          c                   const(x'F5')                         Roll Up             
                     d RollDown        c                   
                const(x'F4')                         Roll Down           
                                                                                                                    
                     d Infds           ds                                                       INFDS data structure
                     d Choice                369    369                                                             
                     d Currec                378    379I 0                                                          
                                                                                                                    
                     d APIError        ds                  Qualified                                                
                     d  BytesP                 1      4I 0 inz
                (%size(apiError))                                     
                     
                d  BytesA                 5      8I 0 inz(0)                                                   
                     
                d  Messageid              9     15                                                             
                     d  Reserved              16     16                                                             
                     d  messagedta            17    256                                                             
                                                                                                                    
                      
                //                                                                                            
                      //  external called programs                                                                  
                      //                                                                                            
                                                                                                                    
                     
                d $sendmsg        PR                  ExtPgm('QMHSNDPM')                                       
                     
                d   MessageID                    7A   Const                                                    
                     
                d   QualMsgF                    20A   Const                                                    
                     
                d   MsgData                    256A   Const                                                    
                     
                d   MsgDtaLen                   10I 0 Const                                                    
                     
                d   MsgType                     10A   Const                                                    
                     
                d   CallStkEnt                  10A   Const                                                    
                     
                d   CallStkCnt                  10I 0 Const                                                    
                     
                d   Messagekey                   4A                                                            
                     d   ErrorCode                  256A                                                            
                                                                                                                    
                     d $clearmsg       pr                  extpgm
                ('QMHRMVPM')                                       
                     
                d   messageq                   276a   const                                                    
                     
                d   CallStack                   10i 0 const                                                    
                     
                d   Messagekey                   4a   const                                                    
                     
                d   messagermv                  10a   const                                                    
                     
                d   ErrorCode                  256                                                             
                                                                                                                    
                      
                //                                                                                            
                      //  procedures                                                                                
                      //                                                                                            
                                                                                                                    
                      
                /Free                                                                                         
                                                                                                                    
                        
                //--------------------------------------------------------                                  
                        // MAIN PROGRAM                                                                             
                        //--------------------------------------------------------                                  
                                                                                                                    
                            
                *inlr = *on;                                                                            
                            
                exsr  $clearsfl;                                                                        
                            
                exsr  $loadsfl;                                                                         
                            
                exsr  $Screen1;                                                                         
                                                                                                                    
                        
                //--------------------------------------------------------                                  
                        // $Screen1 - parameter screen                                                              
                        //--------------------------------------------------------                                  
                             
                begsr $Screen1;                                                                        
                                                                                                                    
                             
                reset  EndScreen1;                                                                     
                              
                dow  not(EndScreen1);                                                                 
                                                                                                                    
                               if 
                ScreenError 'N';                                                                
                                
                $clearmsg('*' : *zero : *Blanks '*ALL' APIError);                               
                               endif;                                                                               
                                                                                                                    
                               
                write FKEY01;                                                                        
                               
                // write MSGCTL;   <== message subfile                                               
                               
                exfmt SUB01CTL;                                                                      
                               
                $clearmsg('*' : *zero : *Blanks '*ALL' APIError);                                
                               
                reset ScreenError;                                                                   
                               if 
                Currec <> *Zeros;                                                                 
                                
                RRN1  =  Currec;                                                                    
                                
                SCRRN =  Currec;                                                                    
                               endif;                                                                               
                                                                                                                    
                               
                select;                                                                              
                            
                //                                                                                      
                            // F3 pressed end the program F3 = LeaveProgram                                         
                            //                                                                                      
                                
                when  Choice LeaveProgram;                                                        
                                 
                EndScreen1 = *on;                                                                  
                            
                //                                                                                      
                            // Enter Key pressed                                                                    
                            //                                                                                      
                                
                when  Choice enterKey;                                                            
                                 
                exsr $validate;                                                                    
                                                                                                                    
                                
                endsl;                                                                              
                               
                enddo;                                                                               
                                                                                                                    
                             
                endsr;                                                                                 
                                                                                                                    
                        
                //--------------------------------------------------------                                  
                        // $Validate - Validate screen entries                                                      
                        //--------------------------------------------------------                                  
                             
                begsr $Validate;                                                                       
                                                                                                                    
                              
                reset screenerror;                                                                    
                                                                                                                    
                             
                //                                                                                     
                             // chain to see if this is a valid open order                                          
                             //                                                                                     
                                                                                                                    
                             // chain (INPRO#) oehdordg;                                                            
                             //  if not%found(oehdordg) and INPRO# <> *zeros;                                       
                              //  *in40 = *on;                                                                      
                              //   messageid   = 'BRC0202';                                                         
                              //   messagedata = *blanks;                                                           
                              //   messagelen = %len(%trim(messagedata));                                           
                              //   exsr $sendmessage;                                                               
                              //   screenerror = 'Y';                                                               
                              // endif;                                                                             
                                                                                                                    
                             
                endsr;                                                                                 
                                                                                                                    
                        
                //--------------------------------------------------------                                  
                        // $process - process subfile number one                                                    
                        //--------------------------------------------------------                                  
                             
                begsr $process;                                                                        
                                                                                                                    
                              for 
                count 1 to SAVRRN;                                                              
                               
                chain count SUB01;                                                                   
                                if %
                found(EXAMPLED);                                                                
                                 
                select;                                                                            
                                  
                when opt# = '2';                                                                  
                                  
                when opt# = '3';                                                                  
                                  
                when opt# = '4';                                                                  
                                  
                when opt# = '5';                                                                  
                                  
                endsl;                                                                            
                                                                                                                    
                                 
                clear opt#;                                                                        
                                 
                update SUB01;                                                                      
                                endif;                                                                              
                              endfor;                                                                               
                                                                                                                    
                              if 
                reloadsub01 = *on;                                                                 
                               
                reloadsub01 = *off;                                                                  
                               
                exsr $clearsfl;                                                                      
                               
                exsr $loadsfl;                                                                       
                              endif;                                                                                
                                                                                                                    
                             
                endsr;                                                                                 
                                                                                                                    
                        
                //----------------------------------------                                                  
                        // $clearSfl - clear the subfile                                                            
                        //----------------------------------------                                                  
                             
                begsr $clearSFL;                                                                       
                                                                                                                    
                              
                // clear the subfile first                                                            
                                                                                                                    
                               
                *in50 = *On;                                                                         
                               *
                in51 = *Off;                                                                        
                               *
                in52 = *Off;                                                                        
                               
                write  SUB01CTL;                                                                     
                               *
                in50 = *Off;                                                                        
                               *
                in51 = *On;                                                                         
                               *
                in52 = *On;                                                                         
                                                                                                                    
                               *
                in45 = *Off;                                                                        
                               
                clear RRN1;                                                                          
                               
                clear SCRRN;                                                                         
                               
                clear SavRrn;                                                                        
                                                                                                                    
                                                                                                                    
                             
                endsr;                                                                                 
                                                                                                                    
                        
                //--------------------------------------------------------                                  
                        // $loadsfl- load up the entire subfile                                                     
                        //--------------------------------------------------------                                  
                             
                begsr $loadsfl;                                                                        
                                                                                                                    
                              if  
                SavRrn  > *zeros;                                                                 
                               
                RRN1  =  SavRrn;                                                                     
                               
                SCRRN =  SavRrn;                                                                     
                              endif;                                                                                
                               
                setll *start prcclst;                                                                
                               
                dou %eof(prcclst);  // <== i do this so I can use ITER                               
                                
                read prcclst;                                                                       
                                if 
                not %eof(prcclst);                                                               
                                 
                // move the fields                                                                 
                                 
                code pcode;                                                                      
                                 
                desc pdesc;                                                                      
                                 
                RRN1 += 1;                                                                         
                                 
                SCRRN RRN1;                                                                      
                                 
                write SUB01;                                                                       
                                endif;                                                                              
                               
                enddo;                                                                               
                                                                                                                    
                              *
                in45 = *on;                                                                          
                              
                savrrn SCRRN;                                                                       
                           
                //                                                                                       
                           //  If no records in subfile then do not disply the subfile.                             
                           //                                                                                       
                              
                if SavRrn  = *zeros;                                                                  
                               *
                in52 = *off;                                                                        
                              else;                                                                                 
                               
                RRN1  1;                                                                           
                               
                SCRRN  1;                                                                          
                              endif;                                                                                
                                                                                                                    
                             
                endsr;                                                                                 
                                                                                                                    
                        
                //----------------------------------------                                                  
                        // $sendmessage - send the program message                                                  
                        //----------------------------------------                                                  
                             
                begsr $sendmessage;                                                                    
                                                                                                                    
                              
                $sendmsg(messageID   :                                                                
                                       
                messageFile :                                                                
                                       
                messagedata :                                                                
                                       
                messageLen  :                                                                
                                       
                '*DIAG'     :                                                                
                                       @
                PGM        :                                                                
                                       
                messagecsc  :                                                                
                                       
                messagekey  :                                                                
                                       
                APIError                                                                     
                                                   
                );                                                               
                                                                                                                    
                             
                endsr;                                                                                 
                                                                                                                    
                        
                //--------------------------------------------------------                                  
                        // *inzsr -  one time run subroutine                                                        
                        //--------------------------------------------------------                                  
                             
                begsr *inzsr;                                                                          
                                                                                                                    
                              
                PGMQ = @PGM;                                                                          
                              
                hdprogram = @PGM;                                                                     
                                                                                                                    
                              
                workcompany 'My Company';                                                           
                              
                LenStr =                                                                              
                              ((%
                len(workcompany) - %len(%trim(workCompany))) / 2) + 1;                             
                              %
                subst(company:LenStr) = %trim(workCompany);                                          
                                                                                                                    
                              
                workTitle 'Some Code Maintenance';                                                  
                              
                LenStr =                                                                              
                              ((%
                len(workTitle) - %len(%trim(workTitle))) / 2) + 1;                                 
                              %
                subst(C1TITLE:LenStr) = %trim(workTitle);                                            
                                                                                                                    
                             
                endsr;                                                                                 
                                                                                                                    
                      /
                End-Free 
                Attached Files
                Last edited by jamief; December 7, 2014, 09:28 AM.
                All my answers were extracted from the "Big Dummy's Guide to the As400"
                and I take no responsibility for any of them.

                www.code400.com

                Comment


                • #9
                  Re: Error attempt to write duplicate records into subfile

                  Originally posted by PeonyWonderWhy
                  I got this error when I do write subfile in rpgle program.
                  What error?

                  Your subject describes the problem; however, you should give a message identifier. Many messages can contain similar text, and the different message IDs can help determine a cause.

                  But I do use physical file without key.
                  How would this still happen?
                  The subfile problem is generally unrelated to your physical file.

                  However, you did make a couple coding errors that will cause trouble.

                  Code:
                  .
                  .
                  .
                  C                   eval      rrn+=1       
                  [B][COLOR="#FF0000"]C     rrn           chain     prcclst[/COLOR][/B]
                  C                   eval      opt#=*blanks 
                  C                   write     #sflrcd      
                  C                   read      prcclst      
                  C                   enddo                  
                  [B][COLOR="#FF0000"]C                   write     #sflrcd[/COLOR][/B]
                   C                   exfmt     #sflctl   
                  .
                  .
                  .
                  I haven't done anything but glance over your code, and two things stand out immediately.

                  First, why are you CHAINing to your input file? You're using a SETLL with a READ loop. There should be no CHAIN used in there. (Also, you have RRN assigned to your subfile. It's not a good idea to use it for your input file at the same time. A RRN variable would only very rarely be meaningful for two different files at the same time.)

                  And second, you have an extra WRITE statement to the subfile after your loop ends. It's not needed for anything. And since RRN wasn't updated since the last subfile write, you're just trying to write to thye same (duplicate) subfile record that was last written.
                  Tom

                  There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors.

                  Why is it that all of the instruments seeking intelligent life in the universe are pointed away from Earth?

                  Comment

                  Working...
                  X