Coding COBOL variable length fields in Gen INLINE CODE
search cancel

Coding COBOL variable length fields in Gen INLINE CODE

book

Article ID: 241898

calendar_today

Updated On:

Products

Gen

Issue/Introduction

Need to move a variable view to a user defined Cobol variable in  Gen  INLINE CODE.

While generating Cobol the length field is not moved

How  to move a Variable view in INLINE CODE?

Environment

Release: 8.6

Component: CA GEN 

Resolution

Create a simple model with workset set WS1 containing text attribute VAR1 with length 10 and set the Varying Length option. Create Common Action block CAB1with Import and Export views for WS1.VAR1 and add  a MOVE import  to export statement.  The generated code shows that it moves the whole view variable. 

Add an inline code statement in the same CAB1. Select COBOL for language and go to "Insert View Reference" it shows  the view name (data) with a + sign on it and expand to  see its Length separately:
 https://api-broadcom-ca.wolkenservicedesk.com/attachment/get_attachment_content?uniqueFileId=7UQ+o2tgJTAXlr4QzYCgMQ==

Select and insert references for both the view and its Length which become variables in the inline code statement to use MOVE statements on

MOVE ##IN.WS1.VAR1## ...
MOVE ##IN.WS1.VAR1.Length## ...

 The generated code will then show:
      * * * * * * * * * * * * * * * * * * * * *
      * 2 : INLINE CODE STATEMENT
      * * * * * * * * * * * * * * * * * * * * *
           MOVE VAR1-0001DV ...
           MOVE VAR1-0001DL ...

So in summary, the developer needs to select both of those view references for a COBOL variable length attribute and make sure to check the expansion of the view name to show its Length .

NOTE: It is only when COBOL is selected that the extra + appears on the view name which can be expanded to show the Length variable. If select any of the other languages C, C#, JAVA there is no extra + on the view.