Make your own free website on Tripod.com

Tips

Using
Fujitsu PowerCOBOL
On This Page:
ActiveX Components
Using CBL_routines in PowerCOBOL
Allowing the User to Cancel a Resource Intensive Task
Calling a KERNEL32.DLL
Default Variable Initialization
Making ENTER work like TAB
Detecting a Right Mouse Click
 
At This Site:
Home
Questions
News
Other Web Resources
Site Feedback
 

Review of ActiveX Components

Submit you favorites here.

Company: Components:

Price:

Comments: Ratings*:

Aebacus Popup Controls http://www.aebacus.demon.co.uk/

CommandBox, Clock, Calendar, EntryBox

$59.99 US These controls provide enhanced masked edit, date pickers, spinbox, combobox, and more. unrated
Vision-Factory http://www.vision-factory.com/activex.htm Zip, UnZip, Round Buttons, Hyperlinks, MP3 player, CD Writer, an Outlook-style 'toolbar' $15-$49 US Requires: Visual Basic and the C-runtime DLL (MFC DLL - v 6.00.8267.0) Zip/Unzip: very useful. Others untested.
dbi technologies inc. www.dbi-tech.com Package of 52 controls. $299 Demos of some of the controls are available on their web page. "easy to use" "work great with Power-COBOL"

* Ratings are a compilation of your comments regarding actual use within PowerCOBOL.

 

Using CBL Routines in PowerCOBOL

Fujitsu PowerCOBOL 4.x ships with a library of very useful routines that augment standard COBOL features. These CBL_ routines as they are called are lumped into the "f3bicblr.lib" library file which defaults to the "c:\fsc\cobol97\" directory when PowerCOBOL is installed. The Fujitsu documentation can be downloaded from this site by clicking on the link below. This documentation should be current as of version 4.2, but should be valid for all previous versions. CBLDOCS.ZIP (39K)

CBL Routines Arranged by Catagory:  
 
Byte-Stream File routines:
CBL_CLOSE_FILE, CBL_CREATE_FILE, CBL_FLUSH_FILE, CBL_OPEN_FILE, CBL_READ_FILE, CBL_WRITE_FILE

Filename Routines:
CBL_JOIN_FILENAME, CBL_SPLIT_FILENAME

File Routines:
CBL_CHANGE_DIR, CBL_CHECK_FILE_EXIST, CBL_COPY_FILE, CBL_CREATE_DIR, CBL_DELETE_DIR, CBL_DELETE_FILE, CBL_LOCATE_FILE, CBL_READ_DIR, CBL_RENAME_FILE, PC_FIND_DRIVES, PC_READ_DRIVE, PC_SET_DRIVE,

Memory Allocation Routines:
CBL_ALLOC_MEM, CBL_FREE_MEM2

Virtual Heap Routines:
CBL_OPEN_VFILE, CBL_CLOSE_VFILE, CBL_WRITE_VFILE, CBL_READ_VFILE

Operating System Information Routines:
CBL_GET_OS_INFO

Text Routines:
CBL_TOUPPER, CBL_TOLOWER

Logic Operator Routines:
CBL_AND, CBL_EQ, CBL_IMP, CBL_NOT, CBL_OR, CBL_XOR

Screen Routines:
CBL_GET_CSR_POS, CBL_SET_CSR_POS, CBL_SET_CSR_SHAPE, CBL_CREATE_SCR, CBL_WRITE_SCR_TTY_CHAR, CBL_WRITE_SCR_TTY, CBL_CLEAR_SCR, CBL_GET_SCR_SIZE, CBL_GET_SCR_GRAPHICS, CBL_GET_SCR_LINE_DRAW, CBL_ALARM_SOUND, CBL_BELL_SOUND, CBL_GET_VGA_MODE, CBL_WRITE_SCR_N_ATTR, CBL_WRITE_SCR_N_CHAR, CBL_WRITE_SCR_N_CHATTR, CBL_WRITE_SCR_ATTRS, CBL_WRITE_SCR_CHARS, CBL_WRITE_SCR_CHARS_ATTR, CBL_WRITE_SCR_CHATTRS, CBL_READ_SCR_ATTRS, CBL_READ_SCR_CHARS, CBL_READ_SCR_CHATTRS, CBL_SWAP_SCR_CHATTRS, CBL_SET_SCR_TERMKEY, CBL_SET_SCR_KEYFILE, CBL_READ_SCR_KEY

Mouse Routines:
CBL_GET_MOUSE_MASK, CBL_GET_MOUSE_STATUS, CBL_INIT_MOUSE, CBL_READ_MOUSE_EVENT, CBL_SET_MOUSE_MASK, CBL_TERM_MOUSE, CBL_GET_MOUSE_POSITION, CBL_SET_MOUSE_POSITION, WIN_GET_MOUSE_SHAPE, WIN_SET_MOUSE_SHAPE, CBL_HIDE_MOUSE, CBL_SHOW_MOUSE

Keyboard Routines:
CBL_GET_KBD_STATUS, CBL_READ_KBD_CHAR

For these routines to work within PowerCOBOL, the f3bicblr library must be linked with the project. Do do this, I right-click on the project's module and select "Insert File...", select "f3bicblr.lib" from (my) "c:\fsc\cobol97\" directory. See the note below if this doesn't work for you.

NOTE: You must link the correct version of f3bicblr.lib. for your version of PowerCOBOL. If you do not find the routines on your system, check the "PATCH" directory on the distribution CD. Following is a note from a Fujitsu support person:
"If someone needs CBL_Routines for their 4.1 version, they can download it from the website.  CBL_Routines work ONLY for the version it was intended to work with. If using 4.0, use 4.0 CBL_Routines, if using 4.1, use 4.1 CBL_Routines and so forth.  Anyone receiving the 4.2 version automatically received the latest 4.2 CBL_Routines. They can not be mixed with other versions. I'm saying this because of your comment about downloading from www.adtools.com. The CBL_Routines are normally included on the CD's under the PATCH folder.  They can be copied over if they were not installed.  That's especially for 4.0 and possibly 4.1 users. I believe the 4.2 install automatically includes the CBL_Routines to be installed and they are found under the Samples folder."

Fujistsu has created an extensive set of sample programs and documentation.

Sample Programs:

The sample programs are installed by default at "C:\FSC\COBOL97\samples\CBL_Routines". If these samples are not on your PC then you can access several of them at the Fujitsu COBOL web site.

CBL Documentation:

The Fujitsu documentation can be downloaded from this site by clicking on the link below. This documentation should be current as of version 4.2, but should be valid for all previous versions. CBLDOCS.ZIP (39K)

 

Allowing the User to Cancel a Resource Intensive Task

Here are some general notes regarding cancelling or otherwise interrupting a busy program in Windows:

  • PowerCOBOL does not support multi-threading (no big deal really)
  • For all single-threaded Windows programs, a "tight" process (i.e. file i/o, counting, etc) will tie up a single thread so that, until the process finishes, no outside control can influence that process. This explains why "Cancel" buttons don't work if the program is busy.
  • All Windows programs (whether multi-thread or not) must be designed so as to minimize the amount of time the program spends in a "tight" process. This is just part of being a good Windows programmer.
  • To accomplish a resource intensive task, but still allow the user the ability to cancel, one must "break" out of the task and allow the program to check for any waiting events or value changes that may effect operation.

There are two ways of accomplishing this last item. One can use the Timer control to execute a task, or one can use a little known, undocumented PowerCOBOL event called THRUEVENT.

Using the Timer Control:

First design the task (procedure) in such a way so that the task must be called multiple times until the job is completed. Then call the task using the Timer event, with the timer set to an amount of time less than the expected processing delay caused by the task (this is to prevent slowing execution down considerably). Here is an example in pseudo-code:

  (start-routine)
     Get filename to process.
     Open filename.
     Start Timer.

(timer-event)
     Process next 100 records Returning status.
     If Status = Done
        Stop-Timer
        Call Rest-of-program...

(cancel-event)
    Stop Timer.

Here is an example.

Using the undocumented THRUEVENT Method:

This method causes program control to temporarily swing back to the form, so that any new values or events can be processed. There is an important word of caution though...if while program control is released using this method and the form is "deactivated," part of your app will be left running invisibly in Windows, causing all sorts of trouble. So the programmer MUST NOT let the form close until the process is either finished or an "EXIT PROGRAM" or such has been called in the called sub-program. In other words, just because THRUEVENT lets events execute during a process you still can't just ignore the fact that the process it still running and you must quit out of it as you would normally do in a cancel situation.

Here is an example.

 

Calling a KERNEL32.DLL

Function from a PowerCOBOL Application

This example program was created with PowerCOBOL version 4.2 but should work with 4.0 as well. I tried to document the code, and currently that is all the documentation included. If anybody has problems getting this example working I can compile documentation as difficulties arise.

Related product documentation: Fujitsu COBOL User's Guide for Windows 4.0, chapter 10.

Download CallK32.ZIP

 

Default Variable Initialization

Unlike several other COBOL compilers, Fujitsu's software seems to by default initialize variables to null instead of zero.

 

Making ENTER work like TAB

In some cases it is useful to allow the user to move through a from by pressing the ENTER key instead of the Window's standard TAB key. This is quite simple to accomplish. Create a "Return" event for each field in the form, and in that event code:

  INVOKE CmControl "SetFocus".

Here is an example.

 

Detecting a Right Mouse Click

It is quite easy to detect a right mouse click. Simply create either a MouseUp or a MouseDown event for the desired control and insert the following code:

 
IF POW-BUTTON = POW-KEY-RBUTTON THEN
    *> Do something....

END-IF.

Disclaimer: The author of this page appreciates the low-cost (free) hosting service offered by Tripod.com, but does not necessarily endorse the products advertised while this site is viewed. Thank you.

Nedstat Counter