View previous topic :: View next topic
|
Author |
Message |
parthasaha
New User
Joined: 25 Feb 2008 Posts: 3 Location: bangalore
|
|
|
|
How can i read line by line in cobol and check any clause/words are there or not??? if there then how can I fetch that clause from that program and write in a PS file????give a program as example |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10886 Location: italy
|
|
|
|
Your requirement, is certainly clear to You, but was not described properly,
pleas post a few lines of cobol code ( use the code tag )
and Your expected result.
somebody will come up with suggestions |
|
Back to top |
|
|
parthasaha
New User
Joined: 25 Feb 2008 Posts: 3 Location: bangalore
|
|
|
|
PSFILE1:
-----------------------------
IDENTIFICATION DIVISION.
PROGRAM-ID. PROG1.
DATA DIVISION.
WORKING-STORAGE SECTION.
EXEC SQL INCLUDE SQLCA END-EXEC.
EXEC SQL INCLUDE EMPDCL END-EXEC.
PROCEDURE DIVISION.
001PROG1.
EXEC SQL
SELECT EMPNO FROM EMP WHERE EMPNO='EMP001'
END-EXEC.
STOP RUN.
IDENTIFICATION DIVISION.
PROGRAM-ID. PROG2.
DATA DIVISION.
WORKING-STORAGE SECTION.
EXEC SQL INCLUDE SQLCA END-EXEC.
EXEC SQL INCLUDE SALDCL END-EXEC.
EXEC SQL INCLUDE DEPTDCL END-EXEC.
PROCEDURE DIVISION.
001PROG2.
EXEC SQL
SELECT SALARY,EMPNO FROM SAL WHERE EMPNO='EMP002'
END-EXEC.
EXEC SQL
SELECT DEPTNO,DEPTNM FROM DEPT WHERE DEPTNO='DEPT1'
END-EXEC.
STOP RUN.
//////////////////////////////////////////////////////////////
PSFILE2.
----------------------------------------
PROGRAM-ID. PROG1.
EXEC SQL
SELECT EMPNO FROM EMP WHERE EMPNO='EMP001'
END-EXEC.
PROGRAM-ID. PROG2.
EXEC SQL
SELECT SALARY,EMPNO FROM SAL WHERE EMPNO='EMP002'
END-EXEC.
EXEC SQL
SELECT DEPTNO,DEPTNM FROM DEPT WHERE DEPTNO='DEPT1'
END-EXEC.
////////////////////////////////////////////////////////////////////////
NOW PSFILE1 IS THE INPUT OF A COBOL PROGRAM AND PSFILE2 IS THE OUTPUT OF THAT PROGRAM.
SO HOW CAN I DO THIS.....
|
|
Back to top |
|
|
vasanthkumarhb
Active User
Joined: 06 Sep 2007 Posts: 275 Location: Bang,iflex
|
|
|
|
HELLO,
What is your question? |
|
Back to top |
|
|
murmohk1
Senior Member
Joined: 29 Jun 2006 Posts: 1436 Location: Bangalore,India
|
|
|
|
Partha,
Quote: |
NOW PSFILE1 IS THE INPUT OF A COBOL PROGRAM AND PSFILE2 IS THE OUTPUT OF THAT PROGRAM.
SO HOW CAN I DO THIS..... |
Genrally asking/posting in 'caps' is treated as aggressive. Don't be when are seeking some1s help. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10886 Location: italy
|
|
Back to top |
|
|
parthasaha
New User
Joined: 25 Feb 2008 Posts: 3 Location: bangalore
|
|
|
|
question :how can i write a program in cobol so that program will take the PSFILE1 as input and fetch the program-id and exec sql part from the PSFILE1 and it will be written into another file (PSFILE2) as shown in the above example......... |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10886 Location: italy
|
|
|
|
I guess that nobody will give You an answer...
COBOL might not be the best choice for string handling and syntax analysis
especially if You need help to do it
the link I gave You shows how to do it in rexx
( even if it has some glitches )
it' s the second post on the subject, I wonder what is the business need |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
Quote: |
it' s the second post on the subject, I wonder what is the business need |
I think a customer wants more documentation then the project team maintained or the system is slow. All of the sql statements are available in the DBRM, they may require some manipulation but it is easier then trying to extract it from the source code. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
IMHO - a major problem with writing this kind of code (and having it be complete, rather than a mere skeleton), is that the "program" needs to be almost as smart as the compiler.
The sql examples posted are among the simplest possible and even those could present a bit of a coding challange (doesn't matter which programming language) If one was to use COBOL, thank goodness for reference modification. . .
Quote: |
I think a customer wants more documentation |
Even if someone documented all of the initial sql, as the system was maintained/enhanced, it is likely that the external documentation for the sql was not maintained. . .
Quote: |
All of the sql statements are available in the DBRM, they may require some manipulation but it is easier then trying to extract it from the source code. |
If it was my task, i'd invest in code to use the DBRM info rather than the COBOL source. |
|
Back to top |
|
|
UmeySan
Active Member
Joined: 22 Aug 2006 Posts: 771 Location: Germany
|
|
|
|
Hi parthasaha !
question :how can i write a program in cobol so that program will take the PSFILE1 as input and fetch the program-id and exec sql part from the PSFILE1 and it will be written into another file (PSFILE2) as shown in the above example.........
My answer: The same old way, as you do in every cobol programm.
Reading input file line by line, checking against a condition, moving strings to output sentence and writing output file. So what.
Or am i such a fool, that i could not understand your question ???
Regards, UmeySan |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
Reading input file line by line, checking against a condition, moving strings to output sentence and writing output file. So what. |
A bit of an oversimplification perhaps. . . |
|
Back to top |
|
|
Itanium
Active User
Joined: 22 Jan 2006 Posts: 114 Location: India
|
|
Back to top |
|
|
|