COBOL
IDENTIFICATION DIVISION.
PROGRAM-ID. VOGAIS.
ENVIRONMENT DIVISION.
*
DATA DIVISION.
*
WORKING-STORAGE SECTION.
*
01 WS-NOMES.
05 WS-NOME PIC X(1) OCCURS 7 TIMES.
01 WS-VOGAIS.
05 WS-VOGAL PIC X(1) OCCURS 7 TIMES.
01 WS-CONSOANTES.
05 WS-CONS PIC X(1) OCCURS 7 TIMES.
01 WS-IND-NOM PIC 9(2).
01 WS-IND-VOG PIC 9(2) VALUE 1.
01 WS-IND-CON PIC 9(2) VALUE 1.
01 WS-VOG-CONT PIC 9(2) VALUE 0.
01 WS-CON-CONT PIC 9(2) VALUE 0.
*
PROCEDURE DIVISION.
*
MAIN.
PERFORM NOME.
PERFORM VERIFICA
VARYING WS-IND-NOM FROM 1 BY 1
UNTIL WS-IND-NOM > 7.
*
DISPLAY WS-NOME(WS-IND-NOM).
DISPLAY 'NUMERO DE VOGAIS = ' WS-VOG-CONT.
DISPLAY 'VOGAIS = ' WS-VOGAL(WS-IND-VOG).
DISPLAY 'NUMERO DE CONSOANTES = ' WS-CON-CONT.
DISPLAY 'CONSOANTES = ' WS-CONS(WS-IND-CON).
*
NOME.
MOVE 'R' TO WS-NOME(1).
MOVE 'O' TO WS-NOME(2).
MOVE 'B' TO WS-NOME(3).
MOVE 'E' TO WS-NOME(4).
MOVE 'R' TO WS-NOME(5).
MOVE 'T' TO WS-NOME(6).
MOVE 'O' TO WS-NOME(7).
*
VERIFICA.
IF WS-NOME(WS-IND-NOM) EQUAL 'A' OR EQUAL 'E' OR EQUAL 'I'
OR EQUAL 'O' OR EQUAL 'U'
MOVE WS-NOME(WS-IND-NOM) TO WS-VOGAL(WS-IND-VOG)
ADD 1 TO WS-IND-VOG
ADD 1 TO WS-VOG-CONT
ELSE
MOVE WS-NOME(WS-IND-NOM) TO WS-CONS(WS-IND-CON)
ADD 1 TO WS-IND-CON
ADD 1 TO WS-CON-CONT
END-IF
.
STOP RUN.
PROGRAM-ID. VOGAIS.
ENVIRONMENT DIVISION.
*
DATA DIVISION.
*
WORKING-STORAGE SECTION.
*
01 WS-NOMES.
05 WS-NOME PIC X(1) OCCURS 7 TIMES.
01 WS-VOGAIS.
05 WS-VOGAL PIC X(1) OCCURS 7 TIMES.
01 WS-CONSOANTES.
05 WS-CONS PIC X(1) OCCURS 7 TIMES.
01 WS-IND-NOM PIC 9(2).
01 WS-IND-VOG PIC 9(2) VALUE 1.
01 WS-IND-CON PIC 9(2) VALUE 1.
01 WS-VOG-CONT PIC 9(2) VALUE 0.
01 WS-CON-CONT PIC 9(2) VALUE 0.
*
PROCEDURE DIVISION.
*
MAIN.
PERFORM NOME.
PERFORM VERIFICA
VARYING WS-IND-NOM FROM 1 BY 1
UNTIL WS-IND-NOM > 7.
*
DISPLAY WS-NOME(WS-IND-NOM).
DISPLAY 'NUMERO DE VOGAIS = ' WS-VOG-CONT.
DISPLAY 'VOGAIS = ' WS-VOGAL(WS-IND-VOG).
DISPLAY 'NUMERO DE CONSOANTES = ' WS-CON-CONT.
DISPLAY 'CONSOANTES = ' WS-CONS(WS-IND-CON).
*
NOME.
MOVE 'R' TO WS-NOME(1).
MOVE 'O' TO WS-NOME(2).
MOVE 'B' TO WS-NOME(3).
MOVE 'E' TO WS-NOME(4).
MOVE 'R' TO WS-NOME(5).
MOVE 'T' TO WS-NOME(6).
MOVE 'O' TO WS-NOME(7).
*
VERIFICA.
IF WS-NOME(WS-IND-NOM) EQUAL 'A' OR EQUAL 'E' OR EQUAL 'I'
OR EQUAL 'O' OR EQUAL 'U'
MOVE WS-NOME(WS-IND-NOM) TO WS-VOGAL(WS-IND-VOG)
ADD 1 TO WS-IND-VOG
ADD 1 TO WS-VOG-CONT
ELSE
MOVE WS-NOME(WS-IND-NOM) TO WS-CONS(WS-IND-CON)
ADD 1 TO WS-IND-CON
ADD 1 TO WS-CON-CONT
END-IF
.
STOP RUN.
JCL
//GUI1504C JOB (GUI1504),GUI1504,CLASS=A,MSGCLASS=X,NOTIFY=GUI1504
//PROCLIB JCLLIB ORDER=IBMMFS.PROC.IBMCOB
//STEP1 EXEC IGYWCG
//COBOL.SYSIN DD DSN=GUI1504.COBOL.VOGAL,DISP=SHR
//SYSOUT DD SYSOUT=*
/*
//PROCLIB JCLLIB ORDER=IBMMFS.PROC.IBMCOB
//STEP1 EXEC IGYWCG
//COBOL.SYSIN DD DSN=GUI1504.COBOL.VOGAL,DISP=SHR
//SYSOUT DD SYSOUT=*
/*