Solved

Cobol DISPLAY needs Enter

Posted on 2001-07-23
15
694 Views
Last Modified: 2008-02-01
I'm new in AS/400, so I wrote this program with all the Identification division and etc.
       MAIN-PROC.
             PERFORM SHOW-HELP.
             STOP RUN.
       SHOW-HELP.
             DISPLAY "tstcblc messages blocks length [max_errors]".
             DISPLAY "  messages    - specifies the number of messages".
             DISPLAY "  blocks      - specifies the number of blocks".
             DISPLAY "                in each message".

Now, when I executing this program it prints the first line "tstcblc messages blocks length [max_errors]" and waiting for me press Enter and only after my Enter it displays the second line and so on...
Why this ?

Thanks.


0
Comment
Question by:Maximka2000
  • 7
  • 3
  • 3
  • +1
15 Comments
 
LVL 2

Expert Comment

by:xinger
ID: 6310834
This is discussed in fair detail in the COBOL Reference manual.  Go to
http://publib.boulder.ibm.com/cgi-bin/bookmgr/BOOKS/qbkaqr00/8.12

0
 

Author Comment

by:Maximka2000
ID: 6312707
Yes, but my as400 DISPLAYs the output not in file , but in
Display Program Message and in the article You sended there is noting about it.
Thank for trying anyway.
0
 
LVL 3

Expert Comment

by:P_S_Price
ID: 6316342
Maximka2000. This is correct. Display does do what you are describing. Messages are sent to the external message Queue of the Job, and then on to the display screen. The COBOL manual does explain this. For your Information RPG has a similar Op Code (DSPLY) which does exactly the same.
0
 

Author Comment

by:Maximka2000
ID: 6316365
So what is the solution for this problem ? What You trying to say to me that in Cobol for AS400 there is no way to output information on screen ?? Are you sure ? Sorry , but I don't believe you.
Thank you anyway.
0
 

Author Comment

by:Maximka2000
ID: 6316371
What happen with this site of "Experts" that doesn't know so basic operator like DISPLAY ???
0
 
LVL 3

Expert Comment

by:P_S_Price
ID: 6316391
You asked a specific Question, Why does DISPLAY do what it does, and I have answered you. I assume from the Tone & response of your comments that you are a PC 'Wizard', used to a PC version of COBOL. Well I have news for you!! the AS/400 aint a PC. Display sends messages to a variety of places according to how you use it, including the values that you set up in special names section. You cannot use it to build up display screens. If you want to do that then you must use Display Files correctly defined within the appropriate divisions. I suggest that you read the COBOL reference and Users Guide for full information on how to do this, and keep your sarcastic remarks to yourself. Snide comments aint the way to get help.
0
 

Author Comment

by:Maximka2000
ID: 6316446
Well, sorry P S Price if I wasn't nice , but it is true I'm a PC networking programmer. So I ported some socket program to AS400 and now I need to write some testing program in Cobol, so I remember Cobol from College, so sorry I realy thought that DISPLAY is the most basic operator in COBOL , but I see my mistake. For example printf of C prints in AS400 environment in some other place then DISPLAY of Cobol and this printf  doesn't suspend until I press Enter , do You know some Cobol operator that outputs not in "Display Program Message" , but in the same place like printf of C ???
Thank you man, be cool.
0
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
LVL 3

Expert Comment

by:P_S_Price
ID: 6316468
I am afraid that I dont know C at all, and so cant comment on what printf does. I assume therefore that you wish the DISPLAY activity to go on the screen in a rolling 'Log type' format as it does in a DOS Session. If this is true then you are going to have some difficulty. The AS/400 Display screens dont exactly work that way. You will need to handle the displaying/rolling within the COBOL program to an external display file.

I much easier solution would be to create a Physical File for the Purpose, and have the COBOL program Write to that.

You REALLY need to reed the COBOL manuals on the IBM web site
0
 

Author Comment

by:Maximka2000
ID: 6316534
The way with Physical File I already know , I told you that I ported some networking program and that program writes it output to some log file and has some output into trace file too. BUT how the printf of C prints it without no problem ? Just create C program , I guess you know how to do that just physical file and src in it with C extension. Put in that code:
#include <stdio.h>

void main(void)
{
   printf("Hello world\n");
   printf("Hello second time\n");
}

after this do the CRTCMOD , and then CRTPGM.
And call that PGM file and you will see that this will prints both of strings with no problem. How is it possible ? OK you said that you don't know C, so OK thank you , but I continue to wait for some other answers if don't mind.
Thank you very much anyway. I realy appreciate you ttying to help me! 8-)))
0
 
LVL 16

Expert Comment

by:theo kouwenhoven
ID: 6316691
Maximka2000,

read the information on the page that link that Xinger mentioned http://publib.boulder.ibm.com/cgi-bin/bookmgr/BOOKS/qbkaqr00/8.12

In this text you find : "For an interactive job that uses display device files, DISPLAY statements
   are not normally used."

The DISPLAY and ACCEPT method are for sending and retrieving operator messages.

So there is an other way to display your information???

Yes!!!
I think you have to look for the extended DISPLAY and extended ACCEPT method.

Good Luck
0
 
LVL 2

Expert Comment

by:xinger
ID: 6317034
As P.S.price said, we answered your question 'why this'.  If you don't like the way IBM has implemented the DISPLAY statement, you'll need to dig into using the system API's.  I don't the time, and I don't have the incentive for 50 points, but I'll clue you in to do a search on QMHSNDPM.
0
 
LVL 16

Expert Comment

by:theo kouwenhoven
ID: 6319325
Yep. Xinger is right...
I shell translate it a little bit....
Programming AS400 is an profession not a hobby, so it is a little bit harder than messing around on pc related platforms. (oops there go my 50 points)
0
 

Author Comment

by:Maximka2000
ID: 6321106
Oh, it is OK just say that You don't know even basic things in Cobol like DISPLAY and say that this is not because You are not professional , but because IBM built its AS400 , yeah this is the "cool" way.
What about me? OK I friendly with Win9X, WinNT, Unixes- HP-UX, AIX. And as I said the decision for DISPLAY problem in your (murphey2, xinger and etc.) way I did in my first or second day of using AS400 when I ported my Network Connectivity Tools(written for all the platforms that are in list above) into AS400 with (I return) LOGGING and TRACING features(see my comments above) into Physical Files. So I don't need to be "professional" to do this.  
And I did not ask You for help, because I can't , but because I need it urgently and I haven't no time or reading 100 books for displaying on screen 2-3 messages.
So I thought that there are "Experts" that knows something in this site, but OK I see what person I'm talking to.
Bye.
P.S.Oh, yeah, my dear xinger if you will find the question tell me and I'll up the points to 51 or maybe even 52 points.
So be cool my friends and just don't give answer "It is impossible" for things that you don't know.

0
 
LVL 16

Accepted Solution

by:
theo kouwenhoven earned 50 total points
ID: 6328314
Sorry Maximka2000!

I'm very very sorry but what you understand is not exactly what I ment.
I will type it right this time:
For the "database languages (as cobol, RPG, etc.) the developement is slightly different than other systems.

The as/400 is not an machine where you can create a program in a couple of seconds (minutes), You have to build applications.

The reason for this is that the most platforms are computers with some developmet tools and somtimes some Databases instaled.
The AS/400 is (mora or less) a platform with a database that somtimes have also some development tools.

The (dis)advantage is that some thing are working slightly different (I think beter) than on other platforms(such as automatic recordlocking, intergrated security on all levels,commitment control and....... no viruses!!!)

Some other things that you probably ill find very disturbing, is that you can't do some small things very fast.(but be honest it are always the smal quick "handy"programs that will mess the things-up and not the one that you have created with some consideration).

So for Cobol and RPG it is not possible to send information to printers or screen. These langages can only handle I/O from and to files. So if you like to use the printer or your screen, you have to create a kind of "devicefile".
For printers you can create a printer file (object type PRTF), and for screen handling you create a display file (object type DSPF).
The printer file contains the layout of the information or form you want to print. In the display file you can define a screen layout and a definition of function-keys etc. you like to use.
After desining and "compiling" this file(s), you can use the cobol extended ACCEPT and extended DISPLAY statement to do your screen handling.

Good luck....
0
 

Author Comment

by:Maximka2000
ID: 6331005
Actually I already got the right answer from xinger see this link
http://www.experts-exchange.com/jsp/qManageQuestion.jsp?ta=as400&qid=20156672

But I gave You the points for other interesting facts that I didn't know.
Thank You.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Get to know the ins and outs of building a web-based ERP system for your enterprise. Development timeline, technology, and costs outlined.
In this article, I will show you HOW TO: Perform a Physical to Virtual (P2V) Conversion the easy way from a computer backup (image).
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now