IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

how to add remaining fields in the output file


IBM Mainframe Forums -> COBOL Programming
Post new topic   This topic is locked: you cannot edit posts or make replies.
View previous topic :: View next topic  
Author Message
senthilnathanj

New User


Joined: 31 Jul 2007
Posts: 47
Location: chennai

PostPosted: Mon Oct 17, 2011 12:24 am
Reply with quote

Hi,
For eg:
SELECT NO,NAME,COURSE FROM EMP;

123 XXX MATHS
356 YYY PHYSICS

How to write the file all the records
In FOUT File

In COBOL-DB2 program I am reading all the records using cursor.

Code:

FETCH CURS01 INTO :NO,:NAME,:COURSE
PERFORM UNTIL SQLCODE = 100
IF NO NOT= SPACE THEN
   MOVE 'A'  TO CLASS
   WRITE FOUT
END-IF
IF NAME NOT= SPACE THEN
   MOVE 'B'  TO CLASS
   WRITE FOUT
END-IF
IF COURSE NOT= SPACE THEN
   MOVE 'C'  TO CLASS
   WRITE FOUT
END-IF
FETCH CURS01 INTO :NO,:NAME,:COURSE
END-PERFORM

Excepted Result:
123XXXMATHS
346YYYPHYSICS

My output result is:
MATHS
PHYSICS

Anyone help me how to change the logic.[/code]
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Mon Oct 17, 2011 12:33 am
Reply with quote

the snippet You posted is the same code in this duplicate post
www.ibmmainframes.com/viewtopic.php?t=56462&highlight=
with the variable names changed

topic locked

You were already told on how to change the logic !
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   This topic is locked: you cannot edit posts or make replies. View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts TRIM everything from input, output co... DFSORT/ICETOOL 1
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
Search our Forums:

Back to Top