BCS Delphi XE8 Application Launcher


There are those times when you need to quickly move around the hard disk to locate files.  Since the file appears in the File Specification tab double click to launch it associated application.
dmn01
Click on the Select Sub Directory menu item and the following dialog appears.
dmn02
Click the Select Folder button and the Sub Directories tab is populated with the contents.
dmn03
Click on the sub folder name and the contents of the selected sub folder appears in the File Specifications tab after the user selects the desired extension.
dmn04
Double click on the desired extension and the File Specification tab is populates.
dmn05
When the highlighted item is double clicked the associated application is initiated and processing continues in that application.

A 32 bit executable program may be downloaded by clicking here.
A 64 bit executable program may be downloaded by clicking here.
The component documentation can be found by clicking here.
The source code may be found by clicking here.

Mr. Arch Brooks, Software Engineer, Brooks Computing Systems, LLC authored this article.

BCS COBOL Sequential IO


COBOL programming is far from dead.  With the latest innovations and the addition of object-oriented COBOL the COBOL dialect can take its place among the industry leaders in software creation.

Here is an example of a COBOL mainline.

program-id. mprog as "mprog".
 
       environment division.
       configuration section.
 
       data division.
       working-storage section.
       01 rb pic x(80).
       01 fsw pic x.
 
       procedure division.
      *      perform 0010-create-records.
             perform 0020-8080-repo.
 
           goback.
 
       0010-create-records.
           call "IO01b".
           move "Rec One" to rb
           call "IO01d" using rb.
           move "Rec Two" to rb
           call "IO01d" using rb.
           move "Rec Three" to rb
           call "IO01d" using rb.
           move "Rec Four" to rb
           call "IO01d" using rb.
           move "Rec Five" to rb
           call "IO01d" using rb.
           call "IO01e".
 
       0020-8080-repo.
           call "IO01a" using fsw.
           call "IO02b".
           perform 0030-repro until fsw = "x".
           call "IO01e".
           call "IO02e".
 
       0030-repro.
           call "IO01c" using rb fsw;
           if fsw = ' '
               call "IO02d" using rb.
 
       end program mprog.

You may notice the mainline is comprised of perform and call statements. This approach emphasizes concise re usability of COBOL.

The first subroutine is listed below.

IDENTIFICATION DIVISION.
       PROGRAM-ID. "IO01".
       AUTHOR.  Arch Brooks.
      * Example program to show how to utilize PS IO
 
       ENVIRONMENT DIVISION.
       INPUT-OUTPUT SECTION.
       FILE-CONTROL.
           SELECT Seq-File ASSIGN TO "SEQ.DAT"
       		ORGANIZATION IS LINE SEQUENTIAL.
 
       DATA DIVISION.
       FILE SECTION.
       FD Seq-File.
       01 SeeqRec.
          05  filler  pic x(80).
 
       Linkage Section.
       01  buf-area pic x(80).
       01  eofsw pic x.
 
       PROCEDURE DIVISION.
 
       entry "IO01a" using eofsw.
           open input Seq-File.
           move " " to eofsw.
           goback.
 
       entry "IO01b".
           open output Seq-File.
           goback.
 
       entry "IO01c" using buf-area eofsw.
           read Seq-File into buf-area at end move "x" to eofsw.
           goback.
 
       entry "IO01d" using buf-area.
           Write SeeqRec from Buf-Area.
           goback.
 
       entry "IO01e".
           close Seq-File.
           goback.

The final subroutine is listed below.

IDENTIFICATION DIVISION.
       PROGRAM-ID. "IO02".
       AUTHOR.  Arch Brooks.
      * Example program to show how to utilize PS IO
 
       ENVIRONMENT DIVISION.
       INPUT-OUTPUT SECTION.
       FILE-CONTROL.
           SELECT Seq-File ASSIGN TO "RAT.DAT"
       		ORGANIZATION IS LINE SEQUENTIAL.
 
       DATA DIVISION.
       FILE SECTION.
       FD Seq-File.
       01 SeeqRec.
          05  filler  pic x(80).
 
       Linkage Section.
       01  buf-area pic x(80).
       01  eofsw pic x.
 
       PROCEDURE DIVISION.
 
       entry "IO02a" using eofsw.
           open input Seq-File.
           move " " to eofsw.
           goback.
 
       entry "IO02b".
           open output Seq-File.
           goback.
 
       entry "IO02c" using buf-area eofsw.
           read Seq-File into buf-area at end move "x" to eofsw.
           goback.
 
       entry "IO02d" using buf-area.
           Write SeeqRec from Buf-Area.
           goback.
 
       entry "IO02e".
           close Seq-File.
           goback.

Mr. Arch Brooks, Software Engineer, Brooks Computing Systems, LLC authored this article.

BCS Delphi XE8 Clone A Record Code Generator


This code snippet will generate the source code needed to clone a new record in a data table from an existing record.
dbs

procedure TBCSResumedm.car(ta: TUniTable);
var
  i: Integer;
  buf: String;
  sc: TStringList;
begin
  sc := TStringList.Create;
  sc.Add('  InsertRecord ' + ta.Name +'([');
  i := 0;
  repeat
    buf := '    ' + ta.Name + '.FieldByName(' + '''' + ta.Fields[i].FullName +
      '''' + ').AsString,';
    if i = ta.Fields.Count - 1 then
    begin
      Delete(buf, Length(buf), 1);
      buf := buf +']);';
    end;
    sc.Add(buf);
    Inc(i);
  until i > ta.Fields.Count - 1;
  sc.SaveToFile('xxx.txt');
  sc.Free;
end;

The resulting code is shown below.  Simply create a new procedure in you data module and paste this source code in there and you are ready to clone data records.
InsertRecord atamea([
    nil,
    atamea.FieldByName('fname').AsString,
    atamea.FieldByName('mname').AsString,
    atamea.FieldByName('lname').AsString,
    atamea.FieldByName('addr').AsString,
    atamea.FieldByName('phone').AsString,
    atamea.FieldByName('apemail').AsString,
    atamea.FieldByName('appdate').AsString,
    atamea.FieldByName('ov18').AsString,
    atamea.FieldByName('wus').AsString,
    atamea.FieldByName('felony').AsString,
    atamea.FieldByName('felexp').AsString,
    atamea.FieldByName('posap').AsString,
    atamea.FieldByName('startdate').AsString,
    atamea.FieldByName('skillslictng').AsString,
    atamea.FieldByName('conpres').AsString,
    atamea.FieldByName('pwd').AsString,
    atamea.FieldByName('fmtname').AsString,
    atamea.FieldByName('cat').AsString,
    atamea.FieldByName('obj').AsString]);

Position the table to the record you would like to clone and call the newly created procedure and you record wil be cloned.

Notice the autoinc field is replaced with nil.  This is done so not to interfere with the table’s normal processing.

{*-----------------------------------------------------------------------------
  Procedure: Clone
  Author:    Mr. Arch Brooks, Software Engineer, Brooks Computing Systems LLC
  Date:      20-Aug-2015
  @Param     None
  @Return    None
-----------------------------------------------------------------------------}
 
procedure TBCSResumedm.Clone;
begin
    atamea.InsertRecord ([
    nil,
    atamea.FieldByName('fname').AsString,
    atamea.FieldByName('mname').AsString,
    atamea.FieldByName('lname').AsString,
    atamea.FieldByName('addr').AsString,
    atamea.FieldByName('phone').AsString,
    atamea.FieldByName('apemail').AsString,
    atamea.FieldByName('appdate').AsString,
    atamea.FieldByName('ov18').AsString,
    atamea.FieldByName('wus').AsString,
    atamea.FieldByName('felony').AsString,
    atamea.FieldByName('felexp').AsString,
    atamea.FieldByName('posap').AsString,
    atamea.FieldByName('startdate').AsString,
    atamea.FieldByName('skillslictng').AsString,
    atamea.FieldByName('conpres').AsString,
    atamea.FieldByName('pwd').AsString,
    atamea.FieldByName('fmtname').AsString,
    atamea.FieldByName('cat').AsString,
    atamea.FieldByName('obj').AsString]);
end;

Repeat this process for each table you desire records to be cloned from and you are all set.

This code can also be modified to generate the complete series of SQL statements for subsequent use.

The source code may be found by clicking here.

Mr. Arch Brooks, Software Engineer, Brooks Computing Systems, LLC authored this article.

BCS Delphi XE8 Database Navigation


There are those time when you will need to traverse databases to attain the desired information.
dbs
The BCS Delphi XE8 Database Navigation tool will allow you to traverse to your hearts content.

{*-----------------------------------------------------------------------------
 Procedure: DBPos
 Author: Mr. Arch Brooks, Software Engineer, Brooks Computing Systems LLC
 Date: 19-Aug-2015
 @Param dbn: TDBNavigator; sfn: String
 @Return None
-----------------------------------------------------------------------------}
 
Procedure TBCSPwbC.DBPos(dbn: TDBNavigator; sfn: String);
var
  pb: String;
  cp: String;
begin
  pb := InputBox('Enter Starting Position!', 'Where Do I Start!', '');
  if Trim(pb) = '' then
  begin
    MessageBox(Handle, 'You want to search with a nill string!',
      'No Search Available!', mb_OkCancel);
    exit;
  end;
  cp := dbn.DataSource.Dataset.FieldByName(sfn).AsString;
  if pb < cp then
  begin
    repeat
      dbn.DataSource.Dataset.Prior;
    until ((pb >= dbn.DataSource.Dataset.FieldByName(sfn).AsString) or
      (dbn.DataSource.Dataset.RecNo = 1));
  end
  else
  begin
    repeat
      dbn.DataSource.Dataset.Next;
    until ((dbn.DataSource.Dataset.FieldByName(sfn).AsString >= pb) or
      (dbn.DataSource.Dataset.Eof));
  end;
  cp := cp;
end;

When I observed the scenario I determined the common denominator was the database navigator and a key string field.

In addition to traversing forward the capability to traverse in a backwards direction was also desirable.  Upon initial testing a loop occurred so I determined the logic of the routine would have to detect the start and end of the data set.  The logic was also put into place that determined direction of the search depending on the search key criteria.

If the key was less than the current database position the search would be in a backwards direction.  Conversely if the key was greater then the database position the search would in a forward direction. This handy utility works for any data table connected to database navigator TDBNavigator.

The source code may be found by clicking here.

Mr. Arch Brooks, Software Engineer, Brooks Computing Systems, LLC authored
this article.

BCS Delphi XE8 Task Application Styles


This application allows the user to track and report tasks.  Elapsed times between the start and finished time are calculated automatically.
tlns
To handle date and time data entry the BCS Get Date Time component is used.  This component must be installed to use this utility. Click here to view the component documentation.

A 32 bit executable program may be downloaded by clicking here.
A 64 bit executable program may be downloaded by clicking here.
The component documentation can be found by clicking here.
The source code may be found by clicking here.

Mr. Arch Brooks, Software Engineer, Brooks Computing Systems, LLC authored this article.

BCS Delphi XE8 Program Tracker

During periods of high activity the technician can become overwhelmed with the pace and sheer volume of  programming and task requests.  The BCS Delphi XE8 Program Tracker offers relief for this level of tedium.
ptra01

A MySQL database with the name of “dpt” minus quotes must exist.  Simply import the “dpt.sql” into your installations MySQL platform.

There is a documentation work pad available when you click on the Detailed Description tab as depicted below.
ptra02
Whenever a project is selected click on the List Project File menu item and a list of project files will appear under the project workbench tab.  This tab is dynamically generated.
ptra03
when you double click on any file name in the list the contents of that file is listed in the Code Viewer tab as depicted below.
ptra04
Return to the Files In Project tab by clicking on that tab to return to the list of files.  Double click on the next file to view.

When you return to the Project Description tab and double click on the grid either the Delphi XE8 or the c++ Builder development environment is activated and you can continue development of the application.
ptra05
When the Reports menu item is clicked the Project Details menu item appears and when it is clicked the following report appears.
ptra06
As you can see this is a handy development tool for reviewing and developing Rad application.

The component documentation can be found by clicking here.
The source code may be found by clicking here.

Mr. Arch Brooks, Software Engineer, Brooks Computing Systems, LLC authored this article.

BCS Delphi Cookbook Examples Repository


This application allows the programer to stay organized when working with the examples for the Delphi Cookbook.
dcb
The first task is to identify where the project code resides.
dcbproj

When the user double clicks on the project the compiler is invoked. From there the technician can create the associated executable.

When the user clicks on any other field the program is executed.

This application uses MySQL for the back end so create a MySQL database and call it “delr” (minus quotes).  Our acronym identifies the Delphi Repository.

The first table “ch” is populated and identifies all the chapters.  The second table “rec” is also populated that identifies all the recipes.   The third table (not populated) contains the actual details of the recipes.

When the user inserts a new entry for the project by clicking the “+” in the Project Navigator the following dialog appears.
dcbsf
Simply traverse to the location where the recipes reside and select the associated .dproj file.  the application creates and populates the executable file specifications.

When you click on the desired chapter the application dynamically places you in the details of the lesson.  When you click on a lesson the application dynamically places you in the lesson’s project(s).

A 32 bit executable program may be downloaded by clicking here.
The component documentation can be found by clicking here.
The source code may be found by clicking here.

Mr. Arch Brooks, Software Engineer, Brooks Computing Systems, LLC authored this article.

 

BCS Stackoverflow Code Formatter

To insert a block of code in Stackoveflow every line in the block must contain four spaces.  This utility will take an isolated block and insert four spaces at the beginning of each line the allow you to save the newly modified code and a separate file.

sofu

  • Create a new text file.
  • Copy and paste the code you would like to post on Stackoverflow.
  • Save the text file.
  • Invoke this utility.
  • Open the newly created text file b clicking on the Prepare Stackoverflow Text menu item.
    otf
  • Save the updated output to the text file of your liking.
    stf

The 32 bit application can be downloaded by clicking here.
The 64 bit application can be downloaded by clicking here.
The component documentation can be viewed by clicking here.
The source code can be accessed by clicking here.

Now open the newly formatted file select all and past into your Stackoverflow article. This is a fairly painless way to prepare a block of code for insertion into Stackoverflow.

Mr. Arch Brooks, Software Engineer, Brooks Computing Systems, LLC authored this article.

BCS Delphi XE8 Get Date And Time


There are those time when you will need to establish a date and time.  This utility will allow the end user the capability to do that.

gdnt

A 32 bit executable program may be downloaded by clicking here.
A 64 bit executable program may be downloaded by clicking here.
The component documentation can be found by clicking here.
The source code may be found by clicking here.

Mr. Arch Brooks, Software Engineer, Brooks Computing Systems, LLC authored this article.

BCS Delphi XE8 Invoice Generator


There are those times when the programmer need to submit an invoice so they can be paid for services rendered. invgen
The first task would be to create a MySQL database named “bcsi” (minus quotes). The BCS Select Date And Time Component is required for this software.  Review the specification by clicking here.

There are four primary tables that comprise the database used for the BCS Invoice Generator. The customers table is listed below.

-- phpMyAdmin SQL Dump
-- version 4.3.7
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Jul 16, 2015 at 02:29 PM
-- Server version: 5.6.17
-- PHP Version: 5.5.12
 
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
 
 
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
 
--
-- Database: `bcsi`
--
 
-- --------------------------------------------------------
 
--
-- Table structure for table `cust`
--
 
CREATE TABLE IF NOT EXISTS `cust` (
  `id` int(11) NOT NULL,
  `cust` varchar(125) NOT NULL,
  `cinfo` mediumtext NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1;
 
--
-- Indexes for dumped tables
--
 
--
-- Indexes for table `cust`
--
ALTER TABLE `cust`
  ADD PRIMARY KEY (`id`);
 
--
-- AUTO_INCREMENT for dumped tables
--
 
--
-- AUTO_INCREMENT for table `cust`
--
ALTER TABLE `cust`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=6;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
The services or inventory master table is listed below.
-- phpMyAdmin SQL Dump
-- version 4.3.7
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Jul 16, 2015 at 02:32 PM
-- Server version: 5.6.17
-- PHP Version: 5.5.12
 
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
 
 
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
 
--
-- Database: `bcsi`
--
 
-- --------------------------------------------------------
 
--
-- Table structure for table `invm`
--
 
CREATE TABLE IF NOT EXISTS `invm` (
  `id` int(11) NOT NULL,
  `rdate` datetime NOT NULL,
  `cust` varchar(125) NOT NULL,
  `cinfo` mediumtext NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=latin1;
 
--
-- Indexes for dumped tables
--
 
--
-- Indexes for table `invm`
--
ALTER TABLE `invm`
  ADD PRIMARY KEY (`id`);
 
--
-- AUTO_INCREMENT for dumped tables
--
 
--
-- AUTO_INCREMENT for table `invm`
--
ALTER TABLE `invm`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=11;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
The inventory or services items table is listed below.
-- phpMyAdmin SQL Dump
-- version 4.3.7
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Jul 16, 2015 at 02:35 PM
-- Server version: 5.6.17
-- PHP Version: 5.5.12
 
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
 
 
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
 
--
-- Database: `bcsi`
--
 
-- --------------------------------------------------------
 
--
-- Table structure for table `inv`
--
 
CREATE TABLE IF NOT EXISTS `inv` (
  `id` int(11) NOT NULL,
  `inv` varchar(125) NOT NULL,
  `cost` double NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1;
 
--
-- Indexes for dumped tables
--
 
--
-- Indexes for table `inv`
--
ALTER TABLE `inv`
  ADD PRIMARY KEY (`id`);
 
--
-- AUTO_INCREMENT for dumped tables
--
 
--
-- AUTO_INCREMENT for table `inv`
--
ALTER TABLE `inv`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=6;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
The invoice details table description is listed below.
-- phpMyAdmin SQL Dump
-- version 4.3.7
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Jul 16, 2015 at 02:37 PM
-- Server version: 5.6.17
-- PHP Version: 5.5.12
 
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
 
 
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
 
--
-- Database: `bcsi`
--
 
-- --------------------------------------------------------
 
--
-- Table structure for table `est`
--
 
CREATE TABLE IF NOT EXISTS `est` (
  `id` int(11) NOT NULL,
  `invno` int(11) NOT NULL,
  `cnt` double NOT NULL,
  `task` varchar(125) NOT NULL,
  `cost` double NOT NULL,
  `stot` double NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=latin1;
 
--
-- Indexes for dumped tables
--
 
--
-- Indexes for table `est`
--
ALTER TABLE `est`
  ADD PRIMARY KEY (`id`);
 
--
-- AUTO_INCREMENT for dumped tables
--
 
--
-- AUTO_INCREMENT for table `est`
--
ALTER TABLE `est`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=21;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
The 32 bit executable program may be downloaded here. The 64 bit executable program may be downloaded here. The component documentation can be viewed by clicking here. The source code for this application can be downloaded by clicking here. Once the database is created and the tables are imported simply download either the 32 or 64 bit executable and you should be in operation. invgen When the application comes active I recommend entering the information for one customer and one or more service items. To add a new customer click on the Customers menu item and fill in the required information on the form. To add a new service click on the Services Offered menu item and fill in the rewired information on the form. Each time you create a new invoice (clicking the + (plus button) on the database navigator) you are prompted to select the customer by the appearance of the Customer dialog.  Simply double click on the item in the database grid to select the associated item. When you would like to add a new service provided to the invoice (clicking the + (plus button) on the database navigator) you are prompted to select the service from the available services by double clicking on the desired service to be added. In either scenario the user can perform CRUD operations via the database grid until the desired results are entered into the database.  Then simply double click on the desired item to utilize it in this application. To invoke the reports click on the Reports menu item and a drop down will appear.  Then simply click on the desired menu item to generate the associated report. There are three reports with this application.  The first report is the Invoice Report and is depicted below. invr01 Another report is the Customers Report and it is depicted below. invr02 The final report is for the individual services offered and is depicted below. invr03 This application generates invoices for services rendered and should be of service to the programmers for years into the future. Mr. Arch Brooks, Software Engineer, Brooks Computing Systems, LLC authored this article.