MF nat CV use



Software AG's platform-independent programming language with full support for open-source and Internet applications

MF nat CV use

Postby RazVorox » Tue Nov 15, 2022 6:25 pm

Hi all.
TL;DR -
I'm trying to run a simple DECIDE to change the color of some output fields.
Running z/os mainframe, natural+adabas.

Story mode:
I have a read on repeat, input ID, than FIND the corresponding name (from the record with said ID).
I have a counter, going +1 every iteration.
and I have a simple DECIDE that goes 1=red, 2=blue, etc..
In the map, I've marked the output fields with CV. (I.E. for the DB-NAME field, added CV-NAME)

My question -
How do I use the CV, to change the field color.
(get the firs name in red, second in blue.. etc)

Please and thank you,
RazVorox
RazVorox
 
Posts: 16
Joined: Wed Oct 19, 2022 11:52 am
Has thanked: 7 times
Been thanked: 1 time

Re: MF nat CV use

Postby RazVorox » Thu Nov 17, 2022 6:06 pm

1) HAVE A "VIEW" DEFINED -> MY-DDM-VIEW
2) GET FIELDS TO LOCAL, FROM SAID VIEW - LDAV0001 - PULL (ID) AND (NAME) FIELDS
2) MAKE MAP - MYMAP001 - WITH (KEY-ID) AS INPUT, AND (NAME) AS OUTPUT WITH NAME-CV
*SAME (NAME) AS LOCALS.

* ------------ *
DEFINE DATA
LOCAL USING LDAV0001
...
LOCAL
1 #KEY-ID (A8)
1 #CLR-COUNTER (N1) INIT <1>
...
1 NAME-CV (C)
END-DEFINE
* ------------ *
RP. REPEAT UNTIL #KEY-ID = '.'
*
IF #CLR-COUNTER = 4 #CLR-COUNTER:= 1
ELSE #CLR-COUNTER:= #CLR-COUNTER+1
END-IF
*
DECIDE ON FIRST VALUE OF #CLR-COUNTER
VALUE 1
MOVE (CD=BL) TO NAME-CV
VALUE 2
MOVE (CD=GR) TO NAME-CV
VALUE 3
MOVE (CD=RE) TO NAME-CV
NONE VALUE
WRITE 'NONE VAL'
END-DECIDE
* ------------ *
INPUT USING MAP 'MYMAP001'
* ------------ *
FIND MY-DDM-VIEW WITH ID = #KEY-ID
IF NO RECORDS FOUND
IF #KEY-ID NE '.'
DISPLAY 'NO RECORDS'
END-IF
END-NOREC
END-FIND
END-REPEAT
* -------- *
END
RazVorox
 
Posts: 16
Joined: Wed Oct 19, 2022 11:52 am
Has thanked: 7 times
Been thanked: 1 time


Return to Natural