d3 Copy Command

135 views
Skip to first unread message

Robert S. Lobel

unread,
Jun 9, 2016, 11:54:51 AM6/9/16
to Pick and MultiValue Databases
As you know, a d3 copy command that is preceded by a select command that finds no items will copy the entire file.  In d3 access, is there a solution to this dilemma?

Wols Lists

unread,
Jun 9, 2016, 12:08:57 PM6/9/16
to mvd...@googlegroups.com
On 09/06/16 16:54, Robert S. Lobel wrote:
> As you know, a d3 /copy /command that is preceded by a /select/ command
> that finds no items will copy the entire file. In d3 access, is there a
> solution to this dilemma?
>
Dunno about d3, but some dialects have a SELECT-REQUIRED option. If
something like copy or delete has this option, and there is no select
list present, it will do nothing.

Cheers,
Wol

Kevin Powick

unread,
Jun 9, 2016, 12:32:13 PM6/9/16
to Pick and MultiValue Databases
If you're typing commands at TCL, then you would know that the SELECT returned no items.  So you would stop.

If you're using PROC, you can interrogate the value of "E"

PQ
RI
RO
HSELECT MYFILE
P
IF E
=401 X-EXIT-
HCOPY MYFILE
STON
H
(NEW-FILE<
P


If you're using Execute within mvBasic, you can interrogate the value of the variable in a RETURNING clause.

EXECUTE "SELECT MYFILE" RETURNING ERR
IF ERR
= 401 THEN STOP
DATA
"(NEWFILE"
EXECUTE
"COPY MYFILE"


--
Kevin P

Robert S. Lobel

unread,
Jun 9, 2016, 2:54:20 PM6/9/16
to Pick and MultiValue Databases
Thanks, Kevin, that did the trick!

Ian Harper

unread,
Jun 9, 2016, 4:33:59 PM6/9/16
to Pick and MultiValue Databases
I like to use the SYSTEM(11) function. It returns the number of items selected so it can be used like this:

if system(11) gt 0 then
  data "(bp.live"
  execute "copy bp (o" 
end 
 

 

On Thursday, June 9, 2016 at 9:32:13 AM UTC-7, Kevin Powick wrote:

Peter McMurray

unread,
Jun 9, 2016, 6:56:20 PM6/9/16
to Pick and MultiValue Databases
Hi
I have used the following for many years as is evidenced by it being in capitals
  WANT = 'SSELECT DEBTCON WITH CARDPERM "E" AND WITH CO "':CO:'"'
  EXECUTE WANT
  IF SYSTEM(11) = 0 THEN
      A.ERR = "No Items To Delete"
      RETURN
  END
  SELECT DEBTCON TO ELIST
  CALL @A.PRINTON
The sequence is important I spent some time trying to find out why my printer routine was failing - PRINTON checks the users office and printer type and sets off the necessary print queues.

Scott Ballinger

unread,
Jun 15, 2016, 2:25:53 PM6/15/16
to Pick and MultiValue Databases
If you using PROC (admittedly, I still do), why not just use STON to conditionally run the command(s) following it if there is an active list?

pq
h select customers with bal.due gt "100000" (t
ston
h copy customers (o<
h(big.bal.customers<
p

The very handy D3 "(t" option for select updates the screen with a running total of selected, processed, & percent completed every 100 items. Use "(t1000" to update every 1000, etc.

/Scott Ballinger
Pareto Corporation
Edmonds WA USA

On Thursday, June 9, 2016 at 9:32:13 AM UTC-7, Kevin Powick wrote:

Ed Clark

unread,
Jun 15, 2016, 4:46:12 PM6/15/16
to mvd...@googlegroups.com
I think this also works similarly in basic:
0001 data “copy customers (o”
0002 data “(big.bal.customers”
0003 execute “select customers with whatever” returning err codes
and you can examine err codes to see if the copy happened or not, and how many were copied.

If the select doesn’t return anything, the stacked data doesn’t get executed.
But I can’t remember offhand if the stacked data gets cleared. It works one way on prime-based universe and unidata, and the opposite on pick and reality based systems. On one the data stack is always cleared by an execute, and on the other the unused data stack remains in effect, so needs to be cleared manually with CLEARDATA.

The amount of information from the RETURNING varies too. IIRC, d3 returns all the errmsg codes and arguments, while some other platforms just return the codes, and some just a single status code.

--
You received this message because you are subscribed to
the "Pick and MultiValue Databases" group.
To post, email to: mvd...@googlegroups.com
To unsubscribe, email to: mvdbms+un...@googlegroups.com
For more options, visit http://groups.google.com/group/mvdbms

Reply all
Reply to author
Forward
0 new messages