× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Murali,

There are various ways to achieve this, but sticing with what you've done so
far...

If GMIMONY1 is the output file with the fields you want in it, you could
keep this output file somewhere in your library list, clear it out (CLRPFM),
and use it on the FORMAT keyword on you OPNQRYF.

Eg

OPNQRYF    FILE((GMIMONYF1)) FORMAT (GMIMONY1) QRYSLT('MOFFIC *EQ +        

              %values(''H87'' ''870'' ''890'') & MFIRM +  

              *NE "X"') KEYFLD((MFIRM) (MOFFIC) (MACCT) + 

              (MATYPE) (MCLASS) (MSUBCL))  

You may have a problem here in that there are fields in the KEYFLD list that
are not in the format file, but you should be able to sort that yourself.
Basically the FORMAT file, determines which fields are available from the
results of the OPNQRYF, in a similar way to selecting the fields in an SQL
statement.

Cheers
Colin.W

-----Original Message-----
From: Murali dhar [mailto:hydchap1@xxxxxxxxxxxxxx] 
Sent: 15 September 2003 11:52
To: Midrange Systems Technical Discussion
Subject: Re: RE: opnqryf(how do i automate an sql command in CL)


Hai all,

In my CL PROGRAM 
I VE WRITTEN QUERY LIKE THE FOLLOWING:
-------------------------------------------------
OPNQRYF    FILE((GMIMONYF1)) QRYSLT('MOFFIC *EQ +        

              %values(''H87'' ''870'' ''890'') & MFIRM +  

              *NE "X"') KEYFLD((MFIRM) (MOFFIC) (MACCT) + 

              (MATYPE) (MCLASS) (MSUBCL))                 

 

CPYFRMQRYF FROMOPNID(GMIMONYF1) TOFILE(&FLIB/GMIMONY) +    

             MBROPT(*REPLACE) CRTFILE(*YES) FMTOPT(*NOCHK)


---------------------------------------------------------------
After calling this CL ,I ve runqry the file GMIMONY(i got many columns).....
Since I need only few columns( MOFFIC , MACCT ,MATYPE, MCURCD , MNA1 ,MER
,MTAR) in my out file 
I ve taken shiftF1 after strsql command..i took change session
attributes.... And    'in select OUTPUT ' I ve taken option 3 and created a
file GMIMONY1.I ve run the query like  following on sql 

SELECT MOFFIC , MACCT ,MATYPE, MCURCD , MNA1 ,MER ,MTAR  FROM  GMIMONY(this
file is created in copy from query file command)....i got my required
outfile GMIMONY1 with whatever columns I need.......


But how do i automate this sql command into my CL program (or) there any
easy solutions for this...Iam confused to create file again in the CL
program and copying it by taking format option *MAP/*drop..... Can anyone
help me by giving suggestions... Thanks a ton in advance, Murali.



ps:Thanks colin for ur suggestions...














-----------------------------------------------------------------------
On Mon, 15 Sep 2003 Colin Williams wrote :
>Murali,
>
>Create a temporary workfile (compiled from DDS or create on the fly 
>using SQL CREATE TABLE) with the fields on it that your require and use 
>that nn your OPNQRYF on the FORMAT parameter
>
>Cheers
>Colin.W
>
>-----Original Message-----
> From: Murali dhar [mailto:hydchap1@xxxxxxxxxxxxxx]
>Sent: 15 September 2003 08:25
>To: Midrange Systems Technical Discussion
>Subject: Re:opnqryf
>
>
>hi,
>My file STAFF is having column names as follows:
>---------------------------------------------------------------------
>ID    NAME      DEPT    JOB   YEARS   SALARY   COMM    FIRMCOD
>SEX
>-------------------------------------------------------------------
>I ve written a query which will satisfy my condition...but i want to 
>select only ID NAME DEPT JOB  in my final report..where shud i give the 
>selected column names in opnqryf.....
>
>
>can some one help me immed.
>TIA,
>Murali
>___________________________________________________
>Catering meets Camera; Tanya Weds Sahil.
>Rediff Matchmaker strikes another interesting match
>Visit http://matchmaker.rediff.com?1
>
>_______________________________________________
>This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing 
>list To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe, 
>unsubscribe, or change list options,
>visit: http://lists.midrange.com/mailman/listinfo/midrange-l
>or email: MIDRANGE-L-request@xxxxxxxxxxxx
>Before posting, please take a moment to review the archives
>at http://archive.midrange.com/midrange-l.
>
>For the latest on Bertram Books products and services and for 
>up-to-the-minute book news visit www.bertrams.com
>
>
>This e-mail and any attachments may contain information that is 
>confidential and privileged and is solely for the use of the intended 
>recipient. If you are not the intended recipient please notify the 
>sender and delete this e-mail and any attachments immediately
>
>
>
>
>
>
>_______________________________________________
>This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing 
>list To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe, 
>unsubscribe, or change list options,
>visit: http://lists.midrange.com/mailman/listinfo/midrange-l
>or email: MIDRANGE-L-request@xxxxxxxxxxxx
>Before posting, please take a moment to review the archives
>at http://archive.midrange.com/midrange-l.
>

___________________________________________________
Catering meets Camera; Tanya Weds Sahil.
Rediff Matchmaker strikes another interesting match
Visit http://matchmaker.rediff.com?1


_______________________________________________
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe,
or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.

For the latest on Bertram Books products and services and for up-to-the-minute 
book news visit www.bertrams.com


This e-mail and any attachments may contain information that is confidential 
and privileged and is solely for the use of the intended recipient. If you are 
not the intended recipient please notify the sender and delete this e-mail and 
any attachments immediately







As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.