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
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
nigelosberry

New User


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

PostPosted: Thu Jun 02, 2011 5:05 pm
Reply with quote

No specific reason. icon_redface.gif
In the recent past I have seen many progams writing from a WS record area. Specially when there are multiple record types.
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 5:32 pm
Reply with quote

It's rare a "full" listing would be needed -- most of the time, a few lines of DATA DIVISION and a few lines of PROCEDURE DIVISION are enough to resolve the issue. Of course, getting the o/p to post the right few lines of each can be quite a pain .... icon_smile.gif
Back to top
View user's profile Send private message
ridgewalker58

New User


Joined: 26 Sep 2008
Posts: 51
Location: New York

PostPosted: Thu Jun 02, 2011 8:17 pm
Reply with quote

For our o/p file the DSORG is FBA.

Old programmer here, when a file is defined FBA -- the first byte -- is considered (as was stated above) -- a CARRIAGE CONTROL character. Therefore with the 03 your print lines should show up with one BLANK LINE between each line -- The ZERO in position one is for SKIP A LINE. When I code a print line I allocate ONE EXTRA position in the beginning of the line for the Carriage control.

Remember - this comes from an OLD programmer -- So like all of us -- code the thing yourself and run a few tests to prove what I said is correct or incorredt[/quote]
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 8:49 pm
Reply with quote

ridgewalker50, you also need to take into account whether or not ADV compiler option is being used. I've seen programmers quite puzzled when their 133-byte print line turned into a 134-byte print line due to ADV being used.
Back to top
View user's profile Send private message
ridgewalker58

New User


Joined: 26 Sep 2008
Posts: 51
Location: New York

PostPosted: Thu Jun 02, 2011 10:24 pm
Reply with quote

Mr. Sample, I DID forget about that -- I took out the AFTER ADVANCING long ago -- probably (but I cannot remember) because I was one of the ones who was stumped by the 134 characters. Thank you
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Fri Jun 03, 2011 6:28 am
Reply with quote

Hi,

I'm missing something here, if both 02 and 03 are printed using
Quote:
WRITE PRINT-LINE-T FROM WS-PRINT-LINE-T
AFTER ADVANCING 1 LINES,
then it still does not explain why the leading zero in 02 is replaced with a space.


Gerry
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: Fri Jun 03, 2011 12:50 pm
Reply with quote

Isn't the space the "after advancing 1" and the zero "after advancing 2"?[/quote]
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Fri Jun 03, 2011 2:49 pm
Reply with quote

Hi Bill,

yes I agree with you
Code:
CODE      ACTION BEFORE PRINTING RECORD           
----      -----------------------------           
BLANK     SPACE 1 LINE                           
0         SPACE 2 LINES                           
-         SPACE 3 LINES                           
+         SUPPRESS SPACE                         
1         SKIP TO LINE 1 ON NEW PAGE             
                                                 
THESE ARE ANSI-DEFINED PRINTER CONTROL CHARACTERS


This is from the old reference card.

But if both lines are using AFTER ADVANCING 1 LINES, then both lines should have a blank in position 1 of the output.

Gerry
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: Fri Jun 03, 2011 3:05 pm
Reply with quote

Yes. From the "scattered all over the program" setting of the types I'm assuming that there are a number of writes, rather than one. For such a strange-looking report (which looks really like a download for something, going by tape from the details later supplied) it does seem odd to have different spacing as well. Maybe to check what the default spacing is if you have a mix?

I also like completeness. But we need TS back if he is interested in crossing his eyes and doting over his teas.
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: Fri Jun 03, 2011 3:20 pm
Reply with quote

Default is 1.

Vidya Kajale, if still there, are there any "...ADVANCING 2"s in your program? Also then, can you confirm that your compile option is NOADV?

Nihal, looks like it is a write from working-storage, if we can trust the data-name on the write.
Back to top
View user's profile Send private message
Vidya Kajale

New User


Joined: 01 Jun 2010
Posts: 43
Location: India

PostPosted: Mon Jun 06, 2011 12:33 pm
Reply with quote

Hi ,

There is no compiler option as ADV or NOADV.
Please find below options in compilation. I am using too, DCCS for compilation.

JOB/PROJECT ===> DBIVIDYA
CENTER ===> CLDC
ELEMENT NAME ===> KZWC380Z
ELEMENT TYPE ===>
CONCATENATIONS: COPYLIBS ========> TEST PREP PROD
INCLUDES ========> TEST PREP PROD
SUBLIBS =========> TEST PREP PROD

PRINT OPTIONS: TWO UP ==========> Y
DB2 PRECOMPILE ==> Y
CICS PRECOMPILE => - NOT-APPLICABLE

XPEDITER COMPILE ================> Y
XPEDITER SYMBOLIC LIB ===========> TVSAMD.T6997VK.XPV2.DDIO__________________
CICS DEBUG COMPILE ===============> - NOT-APPLICABLE
COBOL2 1985 STANDARD =============> N NOT-APPLICABLE
STROBE COMPILE ===================> N
DB2 EXPLAIN ===================> _

COMPILE PROCEDURE USED =========> CEXXDXXX
BIND PARMETERS BEING USED ======> TEST

Is there any rule in mainframe that when we try to print numeric value as fist digit in our o/p file it it voilates its first digit?[/code]
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: Mon Jun 06, 2011 12:44 pm
Reply with quote

Vidya Kajale wrote:

Is there any rule in mainframe that when we try to print numeric value as fist digit in our o/p file it it voilates its first digit?


Yes and no.

You are using AFTER ADVANCING when you WRITE. First byte of your record is therefore a "carriage control" character. You have not allowed for this, so you are loosing your first character (which happens to be numeric, but could have been absolutely anything).

Read through the posts. Read the Cobol manuals, look at the JCL manual as well (FBA/VBA for Recfm).

Do you have AFTER ADVANCING 2 also in your program? If not, we're not yet clear about the behaviour of your "0" in "03".
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: Mon Jun 06, 2011 12:46 pm
Reply with quote

You can't not have ADV and not have NOADV. It is like a switch, it can't be neither on nor off (OK, switch analogy can break down if you actually find the "balancing point", but you know what I mean). Look at the list of Options in the Compile listing. Don't just pick on something that has the word Options in it and say "no".
Back to top
View user's profile Send private message
Vidya Kajale

New User


Joined: 01 Jun 2010
Posts: 43
Location: India

PostPosted: Mon Jun 06, 2011 1:08 pm
Reply with quote

we dont have any compile listing option..
Its auto listing...
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: Mon Jun 06, 2011 1:15 pm
Reply with quote

Vidya Kajale wrote:
we dont have any compile listing option..
Its auto listing...


I have no idea what you mean.

Do you get a compile listing when you compile your program?

If yes, then look through the listing, line-by-line if you prefer, or by searching for "Options in effect" or something like that. Then look down to see if you can see NOADV/ADV (it should be the second option, or thereabouts).
Back to top
View user's profile Send private message
Vidya Kajale

New User


Joined: 01 Jun 2010
Posts: 43
Location: India

PostPosted: Mon Jun 06, 2011 2:07 pm
Reply with quote

i found in jobdetails in SYSPRINT by searching for "Options in effect"

Code:
Options in effect:                                                             
 NOADATA                                                                       
 NOADV                                                                         
   APOST                                                                       
   ARITH(COMPAT)                                                               
   AWO                                                                         
 NOBLOCK0                                                                       
   BUFSIZE(31744)                                                               
 NOCICS                                                                         
   CODEPAGE(1140)                                                               
 NOCOMPILE(S)                                                                   
 NOCURRENCY                                                                     
   DATA(31)                                                                     
 NODATEPROC                                                                     
 NODBCS                                                                         
 NODECK                                                                         
 NODIAGTRUNC                                                                   
 NODLL                                                                         


How will i set it to ADV.
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: Mon Jun 06, 2011 2:13 pm
Reply with quote

A good way is to check in the manuals about how to set compiler options. Also look it up, and see what it does. When someone gives you a gun and suggests you pull the trigger, check what it is loaded with first.

One way is CBL ADV as first line in your program (or anywhere before procedure division if you want no-one to be able to find it easily). Check in the manual about what columns are OK, or just try it.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon Jun 06, 2011 2:17 pm
Reply with quote

man, forget the options stuff, it will take another week to educate the ts on compiler options.

just, simply do 1 of 2 things:
  • remove 'after advancing' from your WRITE statement
  • extend you output record 1 char, and do not put anything in the 1st character.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon Jun 06, 2011 2:51 pm
Reply with quote

Hello,

You need to get permission BEFORE modifying any of the compiler options. . .

Some places will not accept code that has changes to the "standard" compiler options for promotion.

Suggest you do as DBZ suggests.
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: Mon Jun 06, 2011 3:20 pm
Reply with quote

Yes, sorry. Topic dragging on so long, I forgot that we were only asking what it was set to originally.

Hopefully this is the end, and the outstanding question about AFTER ADVANCING 2 can continue to be ignored if TS gets output that is wanted.
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 3
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