Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 Other Topics
 Spec-Card

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2006-10-13 : 17:25:34
Lashonda writes "I have a program that reads a spec-card.
READ SPEC-CARD.

IF SPEC-TYPE = 'A'
MOVE SPEC-DATA TO SEL-DEPT-ARR
MOVE 2 TO SEL-DEPT-LEN
PERFORM GET-ALL THRU GA-EXIT.
GO TO END-PROGRAM.

How can I get my Spec-Card to read my Procedure Statement Get-All and print out each dept title at the top of the page. Here is the code that I have:
GET-ALL.
EXEC SQL DECLARE ALLX CURSOR FOR
SELECT
NVL (BUDGET_STRUCTURE.POSITION_NUM, ' ')POSITION_NUM,
NVL (DEPT_CODE, ' ') DEPT_CODE,
NVL (DIV_CODE, ' ') DIV_CODE,
NVL (MASTER.STATUS, ' ') STATUS
FROM COS_POSITION.BUDGET_STRUCTURE,
COS_POSITION.MASTER
WHERE DEPT_CODE = :SEL-DEPT
AND MASTER.POSITION_NUM =
BUDGET_STRUCTURE.POSITION_NUM
ORDER BY DEPT_CODE, DIV_CODE
END-EXEC.
DISPLAY "POSITION-NUM-ARR" POSITION-NUM-ARR.

EXEC SQL OPEN ALLX END-EXEC.
ALL-LOOP.
MOVE SPACE TO VARS.
MOVE ZEROS TO NUM-VARS.
MOVE ZEROS TO AMT.
EXEC SQL
WHENEVER NOT FOUND
GO TO CLOSE-ALL-LOOP
END-EXEC.

EXEC SQL FETCH ALLX
INTO
:POSITION-NUM,
:DEPT-NUM,
:DIV-NUM,
:STATU
END-EXEC.

IF STATU-ARR = 'T'
GO TO ALL-LOOP.

IF DEPT-NUM-ARR NOT = SAVE-DEPT-NUM
IF FIRST-RECORD
MOVE 'N' TO FIRST-RECORD-FLAG
MOVE DEPT-NUM-ARR TO SAVE-DEPT-NUM
MOVE DIV-NUM-ARR TO SAVE-DIv-Num

ELSE
PERFORM GET-DEPT-TITLE THRU GT-EXIT
MOVE DEPT-TITLE-ARR TO PRT-DEPT-TITLE
PERFORM PRINT-TOT-DIV THRU PTO-3-EXIT
PERFORM PRINT-TOT-DEPT THRU PTOT-4-EXIT
MOVE DEPT-NUM-ARR TO SAVE-DEPT-NUM
MOVE DIV-NUM-ARR TO SAVE-DIV-NUM
ELSE
IF DIV-NUM-ARR NOT = SAVE-DIV-NUM
PERFORM PRINT-TOT-DIV THRU PTO-3-EXIT
MOVE DIV-NUM-ARR TO SAVE-DIV-NUM
PERFORM PRINT-HEADINGS THRU PH-EXIT.
PERFORM PRINT-DETAIL THRU PD-EXIT.


GO TO ALL-LOOP.
CLOSE-ALL-LOOP.
EXEC SQL CLOSE ALLX END-EXEC.

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2006-10-13 : 18:34:04
We don't get a lot of COBOL questions here, and I have my doubts that you are using SQL Server because I have never seen an NVL function in SQL Server.

What type of server, OS, COBOL compiler, and database are you using? Someone here may be able to point you to a site where they can help you.


This site seems to have a lot of info for COBOL programming
http://www.cobug.com/cobug/docs/forums0008.html





CODO ERGO SUM
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2006-10-13 : 19:37:28
Ahhh, COBOL, couldn't figure that out. The rest of it is Oracle (NVL = ISNULL). Dbforums would probably be the place:

http://dbforums.com/
Go to Top of Page

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2006-10-13 : 19:50:25
I couldn't really tell if they're after SQL help or COBOL help.



CODO ERGO SUM
Go to Top of Page
   

- Advertisement -