[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference dssdev::decforms

Title:DECforms
Notice:This is not an official software support channel. Kit info: 4.L
Moderator:DSSDEV::FORMS
Created:Thu Mar 23 1989
Last Modified:Fri Jun 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:4004
Total number of notes:16520

3985.0. "Urgent ALIGNMENT issue" by UTRTSC::DORLAND (The Wizard of Odz2) Wed Feb 19 1997 10:40

    
    	Hello,
    	
    	I have a question with respect to Alignment .
    	Consider the following FORMS statements:
    
    	FORM RECORD X1
    		name character(1)
    		numbr word integer
    		state character(1)
    	END RECORD 
    
    		or
    
    	FORM RECORD X1
    	     group mygroup
    		name character(1)
    		numbr word integer
    		state character(1)
             end group
    	END RECORD 
    
    	Now if you compile thisn with FORMS TRANSLATE?MEBER/NOPAD/LIST
    	you'll see that the alignment results in 5 bytes for case 1
    	and 6 for case 2. Probably FORMS aligns groups.
    
    	Now if you try to 'match' this in COBOL you are in trouble:
    
    	WORKING STORAGE SECTION.
    	
    	01 X1.
    		05 name pic x(1).
    		05 numbr pic s9(4) comp.
    		05 state pic x(1).
    
    		or
    
	01 X1.
    	    03 mygroup.
    		05 name pic x(1).
    		05 numbr pic s9(4) comp.
    		05 state pic x(1).
    
    	When compiled with COBOL/ALIGN/MAP=DECL/LIST it will show that
    	both constructs result in a 5 bytes long record. Thus, when
    	using the group construct in FORMS, the application will
    	fail with the unfamous BADRECLEN error.
    	
    	I am having a rather urgent discussion with a customer
    	who is porting some 1000+ COBOL/FORMS application to Alpha.
    	He claims that either FORMS or COBOL is not really using natural
    	alignment, but who is at fault?
    	Is there anything other which may help here?
    
    	Regards and thanks in adavnce,
    
    	Ton Dorland
    
    	(Tested on VMS 6.2, DECCOBOL 2.4, DECFORMS 2.1B)		
T.RTitleUserPersonal
Name
DateLines
3985.1DECforms uses natural alignment by default on AlphaDSSDEV::RICEWed Feb 19 1997 11:375
You are telling DECforms not to use natural alignment by using the /NOPAD
switch.  That switch was added specifically for an older version of COBOL that
did not do natural alignment.

-Tim
3985.2Example showing the problem...UTRTSC::DORLANDThe Wizard of Odz2Wed Feb 19 1997 12:15189
    True, but using /PADDING both at the FORMS and COBOL also doesn't work.
    In the examples below it will result in a FORMS-F-INTDATCOR.
    
    What I am looking for is a correct way to use Forms and Cobol 
    in a aligned way. So far it looks as if there are COBOL constructs
    which translate different from FORMS, which makes it difficult
    to use alignment. The problem is that I can't tell right way
    if COBOL is at fault or DecForms.
    
    example :
    
IDENTIFICATION DIVISION.
PROGRAM-ID. T1.

ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
SOURCE-COMPUTER.  VAX-11.
OBJECT-COMPUTER.  VAX-11.

DATA DIVISION.

WORKING-STORAGE SECTION.

01 session-id PIC x(16).
01 forms-status pic s9(9) comp.
01 where-from pic x(9) value "SYS$INPUT".
01 rec_count pic s9(5) comp value 1.
01 personnel_record.
	03 mygroup.
	05 name pic x(1).
	05 numbr pic s9(4) comp.
	05 state pic x(1).


PROCEDURE DIVISION.

MAIN SECTION.
MAIN-01.

	call "FORMS$ENABLE" using omitted
		BY DESCRIPTOR where-from
		BY DESCRIPTOR session-id
		BY DESCRIPTOR 'TEST'.

	call "forms$receive" USING
		BY DESCRIPTOR session-id
		BY DESCRIPTOR "PERSONNEL_RECORD"
		BY REFERENCE rec_count
		omitted omitted
		omitted omitted
		omitted omitted omitted
		BY DESCRIPTOR personnel_record.

	call "forms$disable" using by descriptor session-id.

    EXIT PROGRAM.

    $ COBOL/ALIGN=PAD T1
    $ LINK T1
    
Form TEST

    Form Data 
        NAME Character(1)
        NUMBR Word Integer
        STATE Character(1)
    End Data

    Form Record PERSONNEL_RECORD
	GROUP MYGROUP
        NAME Character(1)
        NUMBR Word Integer
        STATE Character(1)
	END GROUP
    End Record

    Form Record CONTROL_WORKSPACE
        ERROR_STATUS_FIELD Character(4)
        MESSAGEPANEL Character(80)
    End Record


    Layout VT_LAYOUT
        Device
            Terminal
                Type %VT100
        End Device
        Size 24 Lines by 80 Columns

        Function QUIT_KEY
            Is %F8
        End Function

        Disable Response
            Request Exit Response
                Remove All
            End Response

        End Response

        Receive Response PERSONNEL_RECORD
            Reset All
            Display
                EMPLOYEE_INFO_PANEL
            Activate
                Panel EMPLOYEE_INFO_PANEL
        End Response

        Function Response QUIT_KEY
            Remove All
            Return
                " FQUT"
        End Response


        Panel EMPLOYEE_INFO_PANEL
            Remove
            Literal Text
                Line 1
                Column 23
                Value "EMPLOYEE INFORMATION"
            End Literal

            Literal Text
                Line 7
                Column 1
                Value "Employee name :"
            End Literal

            Literal Text
                Line 8
                Column 1
                Value "Employee number:"
            End Literal

            Literal Text
                Line 9
                Column 1
                Value "State:"
            End Literal

            Literal Text
                Line 15
                Column 1
                Value "Press Return key to move cursor to next field; F12 to "-
                    "move backward."
            End Literal

            Literal Text
                Line 16
                Column 1
                Value "Press Ctrl/Z to save data; PF8 to cancel."
            End Literal

            Field NAME
                Line 7
                Column 18
                Output Picture X(1)
            End Field

            Field NUMBR
                Line 8
                Column 19
                Output Picture S9(4)
            End Field

            Field STATE
                Line 9
                Column 18
                Output Picture X(1)
            End Field

            Literal Text
                Line 2
                Column 23
                Value "--------------------"
            End Literal

            Literal Rectangle
                Line 6	Column 17
                Line 12	Column 50
            End Literal

        End Panel

    End Layout
End Form
    
    $ FORM TRANSLATE/MEMBER/PAD TEST
3985.3Fixed the INTDATCORUTRTSC::DORLANDThe Wizard of Odz2Wed Feb 19 1997 12:257
    Oops. The COBOL field where-from must be declared as
    pic x(10) VALUE 'SYS$INPUT:'. That works, but now COBOL
    /ALIGN=PAD now produces a 8 byte length record so I
    still have a problem. I'll cross prost this in COBOL
    as well..
    
    Rgds, Ton
3985.4Looks like COBOLUTRTSC::DORLANDThe Wizard of Odz2Wed Feb 19 1997 13:025
    Well, the final answer is that some constructs in Dec Cobol
    may result in different records than DecForms, and that it is
    Dec Cobol which is not 100% natural alignment compliant.
    
    Regards, Ton