It looks to me like Activity 4 is about formatting data for output. You need to produce:
0000/2013
00012345
12345**
The first requires the insertion of a slash. COBOL has a slash insertion symbol, '/'. The second is to ensure no zero-suppression, which is the behaviour when a PIC 9(n) field is output, so nothing really to do other than get the length right. The third apparently draws you to the "*" replacement edit field, which is the intention of the question I guess, but the * editing symbol replaces leading zeros only.
One simple way to get the trailing asterisks is to use the data-definition. Define a group item, which is what you will DISPLAY. Subordinate to that, define your number (PIC 9(5)) and follow it immediately with a FILLER (named field if you like) PIC XX which has a VALUE of "**"
(or ALL "*"
, a little extreme for a two-byte field though).
IDENTIFICATION DIVISION.
PROGRAM-ID. ACTIVITY4.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 NUM1 PIC 9(4)/9(4).
01 NUM2 PIC 9(8).
01 NUM3-OUT.
05 NUM3 PIC 9(5).
05 FILLER PIC XX VALUE "**".
PROCEDURE DIVISION.
DISPLAY-VALUES.
DISPLAY-ZEROES.
MOVE 1234 TO NUM1
DISPLAY "1) "
">"
NUM1
"<"
MOVE 12345 TO NUM2
DISPLAY "2) "
">"
NUM2
"<"
MOVE 12345 TO NUM3
DISPLAY "3) "
">"
NUM3-OUT
"<"
STOP RUN
.
I have never put a VALUE on an edited field. The editing is carried out when the field is a target of a COBOL verb. In the COBOLs I use this would not effect the edit, it would just have that literal value. I don't know about GNU OpenCOBOL (formerly OpenCOBOL).