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

Values not writing into o/p file properly


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Vidya Kajale

New User


Joined: 01 Jun 2010
Posts: 43
Location: India

PostPosted: Thu Jun 02, 2011 11:03 am
Reply with quote

Hi ,
The value of field RPT3-REC-TYPE is not coming properly in o/p file. It is truncating 1st byte in some case and in some case it printing correctly.
Code:
20 REPORT-3-KEY-AREA.                             
   25 RPT3-REC-TYPE           PIC X(02).           
   25 RPT3-REC-TYPE-FL        PIC X(01) VALUE ';'.
   25 RPT3-PROC-MTH           PIC X(08).           
   25 RPT3-PROC-MTH-FL        PIC X(01) VALUE ';'.
   25 RPT3-DLR                PIC X(06).           
   25 RPT3-DLR-FL             PIC X(01) VALUE ';'.
   25 RPT3-COMPANY-CODE       PIC X(01).           
   25 RPT3-COMPANY-CODE-FL    PIC X(01) VALUE ';'.
   25 RPT3-ADDRESS            PIC X(35).           

In procedure division we are moving the following values in multiple places.
MOVE '02' TO RPT3-REC-TYPE
MOVE '03' TO RPT3-REC-TYPE
Finally we are writings into output file. As RPT3-REC-TYPE is pic X(2) hence it should contain either ‘02’ or ‘03’ in 1st two positions.
We verify the Output file. The 1st two byte contains ‘2’ instead of ‘03’. For 03 it’s writing into output file as ‘03’. Please suggest us what‘s the actual problem is.

the attachment has been deleted

Please suggest me suitable way.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Jun 02, 2011 11:49 am
Reply with quote

Vidya Kajale wrote:
[...]
The value of field RPT3-REC-TYPE is not coming properly in o/p file. It is truncating 1st byte in some case and in some case it printing correctly.
[...]


1) Is it a space?
2) Is it all the 02's?
3) Is it just the first 02?
4) Is there one of the many 02's in your program (horrible) that isn't actually an 02 but has that value?
5) Are you running with SSRANGE on?
[/quote]
Back to top
View user's profile Send private message
nigelosberry

New User


Joined: 06 Jan 2009
Posts: 88
Location: Ggn, IN

PostPosted: Thu Jun 02, 2011 11:50 am
Reply with quote

Is it possible for you to paste:

(1) record area as defined in working storage(and the variable(s) defined before it).
(2) code for output field population and writing.

Without seeing the full code one can only guess about the possible problem.
Back to top
View user's profile Send private message
Vidya Kajale

New User


Joined: 01 Jun 2010
Posts: 43
Location: India

PostPosted: Thu Jun 02, 2011 11:59 am
Reply with quote

1. yes first byte it writing as spaces.

2. No all are not 02. It depends on record type. i need to print record type in 1st two byte. Insome cases it is 01, 02, 03, 4A, 4B, 4C,4D, 05,06 and so on.

3. And record tpe i am hard coding into program as 02, 03 and so on.

4. SSRANGE is not used.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Thu Jun 02, 2011 12:11 pm
Reply with quote

fro what reason You are posting an attachment in windoze format, containing a screen shot,
wasting 70KB
when a plain cut an paste in text format surrounded by the code tags will take 160 bytes and carry the same info
like this
Code:
0  Settings      Terminal and user parameters            User ID . : ENRICO
1  View          Display source data or listings         Time. . . : 08:40

will carry the same info in a way much more understandable

furthermore not everybody can download attachments, limiting the number of people willing to help

the attachment has been deleted

just a hint,
did You consider that for a print <file/dataset> the first char usually contains the printer control char ( DSORG=FBA/VBA ) ???
Back to top
View user's profile Send private message
Vidya Kajale

New User


Joined: 01 Jun 2010
Posts: 43
Location: India

PostPosted: Thu Jun 02, 2011 12:30 pm
Reply with quote

Hi,

For our o/p file the DSORG is FBA.

When i try to print for record type 03 it printing correctly as 03 but for record type 02 it printing as 2.

So What shall i do?

I tried to cut & paste the o/p file but it was coming in tesx format black and white. How do we cut and paste in mainframe screen layout as u deed in above form.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Thu Jun 02, 2011 12:40 pm
Reply with quote

click the [ Code ] box
paste the lines
click the [ Code ] box again

in the message box You use to type You will see something like
[???code???]the text to be bbcoded [???/code???]

the ??? are placeholders to show,not to do

to see that You do things right use the preview button !
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Thu Jun 02, 2011 12:43 pm
Reply with quote

Hi,

how are you viewing the output ? browse or edit ?


Gerry
Back to top
View user's profile Send private message
Vidya Kajale

New User


Joined: 01 Jun 2010
Posts: 43
Location: India

PostPosted: Thu Jun 02, 2011 12:47 pm
Reply with quote

In edit mode for record type 03 it is showing as 03 and for record type 02 it is showing as 2.

Whereas in browse mode for 03 it is showing as 3 and for 02 it showing 2.
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Thu Jun 02, 2011 12:57 pm
Reply with quote

Hi,

in edit, what column is the 2 in ? 1 or 2 ?


Gerry
Back to top
View user's profile Send private message
Vidya Kajale

New User


Joined: 01 Jun 2010
Posts: 43
Location: India

PostPosted: Thu Jun 02, 2011 1:04 pm
Reply with quote

Hi,

in edit 2 is at 2nd column.
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Thu Jun 02, 2011 1:13 pm
Reply with quote

Hi,

you better provide the information Nigel has requested.


Gerry
Back to top
View user's profile Send private message
nigelosberry

New User


Joined: 06 Jan 2009
Posts: 88
Location: Ggn, IN

PostPosted: Thu Jun 02, 2011 1:25 pm
Reply with quote

For those who joined late, this is what the dataset in teh screenshot supplied by TS had:

Code:
 2;04-30-11;72000 ;1;2 AGAR ST.                                  ;NY;43328;OTHER
03;04-30-11;72000 ;1;2 AGAR ST.                                  ;NY;43328;SPRINT


I have manually typed in the two records(column 1 to 72). Apologies if there's any typo error.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Jun 02, 2011 1:47 pm
Reply with quote

Quote:

For our o/p file the DSORG is FBA.


Good spot enrico.

Concentrate on this Vidya. Why are you defining your output file with print file DSORG? Change it to FB. Have a look at the output.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Jun 02, 2011 1:50 pm
Reply with quote

You want your report to look like that? OK, you have a report, then you have to have carriage control characters. How do they work? Look in the manual.
Back to top
View user's profile Send private message
Vidya Kajale

New User


Joined: 01 Jun 2010
Posts: 43
Location: India

PostPosted: Thu Jun 02, 2011 2:00 pm
Reply with quote

Hi ,

i have given DCB parameters as: DCB=(RECFM=FB,LRECL=300,BLKSIZE=3000)
Record format is FB and i have not mentioned DSORG anywhere.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Jun 02, 2011 2:03 pm
Reply with quote

Vidya Kajale wrote:
Hi,

For our o/p file the DSORG is FBA.

When i try to print for record type 03 it printing correctly as 03 but for record type 02 it printing as 2.

So What shall i do?

I tried to cut & paste the o/p file but it was coming in tesx format black and white. How do we cut and paste in mainframe screen layout as u deed in above form.


Seems you did.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Jun 02, 2011 2:22 pm
Reply with quote

So, no RECFM=FBA.

Blanks and zeros are ANSI print control characters associated with FBA.

When you say "When i try to print" what do you mean? Are you browsing your actual file, or a print that you have done somehow of your actual file?
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Thu Jun 02, 2011 2:45 pm
Reply with quote

What does the SELECT statement look like for this file?

What does the WRITE statement look like for this file?

Your basic issue is that something in COBOL is changing your file from FB to FBA, so you need to find out what is doing it. The most likely culprits are your SELECT statement or the WRITE statement.
Back to top
View user's profile Send private message
Vidya Kajale

New User


Joined: 01 Jun 2010
Posts: 43
Location: India

PostPosted: Thu Jun 02, 2011 2:55 pm
Reply with quote

Select statement is as:
SELECT PRINTER-TAPE-OT-T ASSIGN TO UT-S-WC280TT



And print statement is:

WRITE PRINT-LINE-T FROM WS-PRINT-LINE-T
AFTER ADVANCING 1 LINES,
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Jun 02, 2011 3:04 pm
Reply with quote

So, as suggested previously, look up in the Cobol manual how to use a print file, and where your first byte is going and how you are getting a byte, sometimes it being the same as the one you lost.

Why are you writing them as print records if they are 300 chars long? A very small FCB? Or not intending print at all? Or just what they wanted on the "tape" or what?
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Thu Jun 02, 2011 3:06 pm
Reply with quote

Quote:
AFTER ADVANCING 1 LINES,

using that construct will force an FBA/VBA dcb

time to do a bit of reading Yourself on the
WRITE ... ADVANCING
and the relative consideration on compiler option ADV/NOADV and the consequent use of the first CHAR of the record as a control char.

it would be proper to never mix WRITE and WRITE ADVANCING on the same dataset
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Jun 02, 2011 4:26 pm
Reply with quote

nigelosberry wrote:
Is it possible for you to paste:

(1) record area as defined in working storage(and the variable(s) defined before it).
(2) code for output field population and writing.

Without seeing the full code one can only guess about the possible problem.


I'm curious, why did you think it was in working-storage?

How many times has anyone posted the "full code" in this forum? Or is it only this time that we'd have to "guess" without the full code?
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Thu Jun 02, 2011 4:36 pm
Reply with quote

Quote:
How many times has anyone posted the "full code" in this forum? Or is it only this time that we'd have to "guess" without the full code?
Bill, if you hang around -- get used to guessing. Even when "full code" is posted, more often than not it is retyped and not cut / pasted so it has typos and obvious syntactic errors.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Jun 02, 2011 4:49 pm
Reply with quote

I know what you mean, Robert. Thing was, Nihal seemed to be suggesting resolution not possible without full listing. Somehow, a resolution, led by enrico, emerged. "good spot" not "good guess". First character of file replaced by blanks and zeros (or what ANSI dictates in this instance) look for "printer" characteristics making the mess. No full listing needed, experience and abilitity.

Many times people "guess" based on their experience. Other times we say "we can only guess" which means we have not enough information to do anything with the problem.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming Goto page 1, 2  Next

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 0
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
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
Search our Forums:

Back to Top