Topic
  • 2 replies
  • Latest Post - ‏2014-07-11T02:18:50Z by C1EF_T-Jay_Waldock
C1EF_T-Jay_Waldock
C1EF_T-Jay_Waldock
12 Posts

Pinned topic VARLEN field in LIKEREC dds

‏2014-07-10T20:32:15Z |

I have a file with a VARLEN field for special instructions.  Field name is SPECiNST.  I have not bothered to use this field before now, but I thought I had used VARLEN fields in other files and programs.  I have not confirmed this latter.

When I write to the field in my program and look in the result in the data file, all I get is a single zero - according to Query/400 and WRKDBF.

I am not using CVTOPT in my compiler options.  I defined the LIKEREC DS as *OUTPUT.


000314 d rTsfi           ds                  likerec(rWhsTsf:*input)                                             140704     000314

000315 d                                     inz                                                                 140704     000315

000316 d rTsf            ds                  likerec(rWhsTsf:*output)                                            140704     000316

000317 d                                     inz                                                                 140704     000317

 

What do I have to do to get the VARLEN field to work in these circumstances?


       *--------------------------------------------------------------------*

        * Compiler Options in Effect:                                        *

        *--------------------------------------------------------------------*

        *  Text 'description' . . . . . . . :                                *

        *                 Allocte cuts from initial receipt to whs transfer  *


        *  Generation severity level  . . . :   10                           *

        *  Default activation group . . . . :   *NO                          *

        *  Compiler options . . . . . . . . :   *XREF      *GEN              *

        *                                       *NOSECLVL  *SHOWCPY          *

        *                                       *EXPDDS    *EXT              *

        *                                       *NOSHOWSKP *SRCSTMT          *

        *                                       *DEBUGIO   *UNREF            *

        *                                       *EVENTF                      *

        *  Optimization level . . . . . . . :   *NONE                        =

The input data structure in the compiler listing makes it look like a single charaacter field width:


000001=IRWHSTSF                                                                                                           12000001

        *--------------------------------------------------------------------------------------------*                    12

        * RPG record format  . . . . :  RWHSTSF                                                      *                    12

        * External format  . . . . . :  RWHSTSF : CFSOFTD8/WHSSTKTSF                                 *                    12

        *--------------------------------------------------------------------------------------------*                    12

000002=I                             P    1    4 0TRANSFER#                       Warehouse Transfer #                    12000002

. . .


000033=I                             P   97   99 0DQT20                           Qty Sz Col 20                           12000033

000034=I                        *VAR A  100  421  SPECINST                        Special Inst.                           12000034

000035=I                             A  422  431  TOSTYLE                         To-Style                                12000035

 

The output buffer structure shows it as a variable character field


000001=ORWHSTSF                                                                                                           15000001

        *--------------------------------------------------------------------------------------------*                    15

        * RPG record format  . . . . :  RWHSTSF                                                      *                    15

        * External format  . . . . . :  RWHSTSF : CFSOFTD8/WHSSTKTSF                                 *                    15

        *--------------------------------------------------------------------------------------------*                    15

000002=O                       TRANSFER#            4P PACK      6,0              Warehouse Transfer #                    15000002

. . .


000033=O                       DQT20               99P PACK      5,0              Qty Sz Col 20                           15000033

000034=O                       SPECINST           421A VCHR      320              Special Inst.                           15000034

000035=O                       TOSTYLE            431A CHAR       10              To-Style                                15000035

 

The field assignment is not complicated

rTsf.SpecInst = 'Cut #: ' + parmCompDiv = '-' + parmCut#  ; 

This particular program will only write new records to this file.

write rWhsTsf rTsf ;      

The output looks like a single zero

  System: B00E8FF5                                    Work with Database File                                    Version: V11.05.08
                                                                                                                                    
    File: WHSSTKTSF   Stock Transfer between warehouses                                           Window:    1                      
 Library: QS36F       Format: RWHSTSF    Nbr. Recor                                                                                 
  Member: WHSSTKTSF     Type: PF         Size (Byte                              Display a Database Record                          
                                                                                                                                    
 Opt: 2=Change record   3=Copy record   4=Delete re   Base PF: WHSSTKTSF  Library: QS36F      Member: WHSSTKTSF  RRN: 000003188     
      ....5...10...15...20...25...30...35...40...45                                                                                 
      Tsf     Frm Frm Order                           Field Name Field Description         Field Value                              
      Nbr     Whs Co.  #    Pg# Ln# Sq# Style         DQT11      Qty Sz Col 11                 0                                    
 5      4647  92  VO  0F426  1   2      CL348IR9/O    DQT12      Qty Sz Col 12                 0                                    
                                                      DQT13      Qty Sz Col 13                 0                                    
                                                      DQT14      Qty Sz Col 14                 0                                    
                                                      DQT15      Qty Sz Col 15                 0                                    
                                                      DQT16      Qty Sz Col 16                 0                                    
                                                      DQT17      Qty Sz Col 17                 0                                    
                                                      DQT18      Qty Sz Col 18                 0                                    
                                                      DQT19      Qty Sz Col 19                 0                                    
                                                      DQT20      Qty Sz Col 20                 0                                    
                                                      SPECINST   Special Inst.             0                                   +    
                                                       F3=Exit   F5=Refresh   F8=Hex Mode   F10=Allow Lowercase   F13=Immed Exit    
                                                                                                                                    
                                                                                                                                    
                                                                                                                                    
                                                                                                                                    
 F3=Exit   F4=Position   F6=Add record   F11=Headings   F14=Fields   F16=Find   F18=SQL Cmds   F19=Left   F20=Right   F24=More keys

                                                                                                                                  

 

 

 

 

 

  • barbara_morris
    barbara_morris
    389 Posts

    Re: VARLEN field in LIKEREC dds

    ‏2014-07-10T21:00:05Z  
    You have an = instead of a + in your expression. You are actually assigning a logical value which will always be false ('0'). It's assigning the result of comparing
    'Cut #: ' + parmCompDiv
    to
    parmCut#
    Try this:
    rTsf.SpecInst = 'Cut #: ' + parmCompDiv +  '-' + parmCut#  ;
  • C1EF_T-Jay_Waldock
    C1EF_T-Jay_Waldock
    12 Posts

    Re: VARLEN field in LIKEREC dds

    ‏2014-07-11T02:18:50Z  
    You have an = instead of a + in your expression. You are actually assigning a logical value which will always be false ('0'). It's assigning the result of comparing
    'Cut #: ' + parmCompDiv
    to
    parmCut#
    Try this:
    rTsf.SpecInst = 'Cut #: ' + parmCompDiv +  '-' + parmCut#  ;

    Ouch.  Guess my shift key stuck down.

    That would explain the value of '0' - for *off or "not" - in the file

    Thanks.