scottj@ncrcae.Columbia.NCR.COM (L. Scott Johnson) (07/12/89)
If you have SQL*Forms, the following should be a part of your library. Send any bugs (and fixes, if possible) to scottj@ncrcae.columbia.NCR.COM ------- cut here -------- # This is a shell archive. Remove anything before this line, then # unpack it by saving it in a file and typing "sh file". (Files # unpacked will be owned by you and have default permissions.) # # This archive contains: # README coordinate echo x - README cat > "README" << '//E*O*F README//' SQL*Forms block coordinator This shell script will coordinate any number of detail blocks with a master block in a SQL*Forms form. It modifies the FORM.inp file, so the form will need to be LOADed by SQL*Forms after running this program. The program will prompt you for the master block name, the number of detail blocks and the names of the detail blocks in turn. The .inp file is entered on the command line. The process in brief is: 1. Create the form, complete with all blocks. Do NOT create any triggers in the master block before running coordinate! 2. Save and generate the form 3. Execute the coordinate command, listing the .inp file on the command line. Supply data as requested. 4. In SQL*Forms, DROP the form then enter the form name again and LOAD the form. 5. SAVE the form. //E*O*F README// echo x - coordinate cat > "coordinate" << '//E*O*F coordinate//' #!/bin/sh ##################################### # # coordinate - coordinate blocks of a form in SQL*Forms # # synopsis: # # coordinate _inp_file_ # # Coordinates the actions of the following keys when pressed in the # master block: # # CLRBLK ENTQRY NXTSET # CLRREC EXEQRY PRVREC # CREREC NXTREC # # Written for SQL*Forms Version 20018.4.1 # # Should work for all SQL*Forms releases, but use at your own risk. # No guarantee of the suitability of this program for any purpose # is implied. # # Enjoy. L. Scott Johnson - scottj@ncrcae.columbia.NCR.COM ######################################################################### if [ "$#" -ne 1 ] then echo "Usage: coordinate fn.inp"; exit 1 fi if [ ! -r $1 ] then echo "$1 does not exist or is unreadble"; exit 1 fi #----------------------------------------------------------------------- echo echo 'Name of master block: \c' read master echo '# of detail blocks: \c' read number i=0 while [ "$i" -ne "$number" ] do { i=`expr $i + 1` echo 'Name of detail block' $i': \c' read detail$i list="$list $i" } done echo Working... echo #-------------------------------------------------------------------- cat - >cmd$$ <<EOF /^${master}\\/ /^;Field name : EOF for trg in CLRBLK CLRREC CREREC do { echo o\*KEY-$trg >> cmd$$ echo "#EXEMACRO $trg;" >> cmd$$ for i in $list do { blk=`echo \$detail$i` echo "GOBLK $blk; CLRBLK;" >> cmd$$ } done echo "GOBLK $master;\n\n;Message if value not found:" >> cmd$$ echo "Error coordinating detail records in KEY-$trg" >> cmd$$ echo ";Must value exist Y/N\nY" >> cmd$$ echo ";Field name :'\033" >> cmd$$ } done for trg in ENTQRY EXEQRY NXTREC NXTSET PRVREC do { echo o\*KEY-$trg >> cmd$$ echo "#EXEMACRO $trg;" >> cmd$$ for i in $list do { blk=`echo \$detail$i` echo "GOBLK $blk; EXEQRY;" >> cmd$$ } done echo "GOBLK $master;\n\n;Message if value not found:" >> cmd$$ echo "Error coordinating detail records in KEY-$trg" >> cmd$$ echo ";Must value exist Y/N\nY" >> cmd$$ echo ";Field name :'\033" >> cmd$$ } done echo 'ZZ' >> cmd$$ #-------------------------------------------------------------------- vi $1 < cmd$$ >/dev/null rm cmd$$ echo echo 'Done. Please LOAD the new input file thru SQL*Forms.' echo //E*O*F coordinate// exit 0