﻿<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://owl.unipharm.com/mediawiki/index.php?action=history&amp;feed=atom&amp;title=Information_Systems%3AQuery%2F400</id>
	<title>Information Systems:Query/400 - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://owl.unipharm.com/mediawiki/index.php?action=history&amp;feed=atom&amp;title=Information_Systems%3AQuery%2F400"/>
	<link rel="alternate" type="text/html" href="https://owl.unipharm.com/mediawiki/index.php?title=Information_Systems:Query/400&amp;action=history"/>
	<updated>2026-09-01T16:06:00Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.35.4</generator>
	<entry>
		<id>https://owl.unipharm.com/mediawiki/index.php?title=Information_Systems:Query/400&amp;diff=8732&amp;oldid=prev</id>
		<title>Norwinu at 17:32, 16 August 2017</title>
		<link rel="alternate" type="text/html" href="https://owl.unipharm.com/mediawiki/index.php?title=Information_Systems:Query/400&amp;diff=8732&amp;oldid=prev"/>
		<updated>2017-08-16T17:32:46Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left diff-editfont-monospace&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 17:32, 16 August 2017&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-empty&quot;&gt;&amp;#160;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;+&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt; Note: Whereas Query/400 may have been easier to use for green screen aficionados, it is much easier to take 10 minutes to learn basic SQL instead, and to use the 'Run SQL Scripts' tool of IBM Access Client Solutions to run your statements. The article below is useful for dealing with existing/saved queries done in Query/400, but for new queries (regardeless of it is simple or complicated, ad-hoc or meant to be reused), good god just learn raw SQL and save yourself the trauma. -[[User:Norwinu|norwizzle]] ([[User talk:Norwinu|talk]])&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-empty&quot;&gt;&amp;#160;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;+&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&amp;#160;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=Query=&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&amp;#160;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=Query=&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&amp;#160;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&amp;#160;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Norwinu</name></author>
	</entry>
	<entry>
		<id>https://owl.unipharm.com/mediawiki/index.php?title=Information_Systems:Query/400&amp;diff=3617&amp;oldid=prev</id>
		<title>Norwinu at 16:23, 23 June 2016</title>
		<link rel="alternate" type="text/html" href="https://owl.unipharm.com/mediawiki/index.php?title=Information_Systems:Query/400&amp;diff=3617&amp;oldid=prev"/>
		<updated>2016-06-23T16:23:49Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left diff-editfont-monospace&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 16:23, 23 June 2016&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 404:&lt;/td&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 404:&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&amp;#160;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt; TO		year(work)* 10000 + month(work) * 100 + 31&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&amp;#160;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt; TO		year(work)* 10000 + month(work) * 100 + 31&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&amp;#160;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&amp;#160;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-empty&quot;&gt;&amp;#160;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;+&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Category: IBM i Tools/Utilities]]&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&amp;#160;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Category: Database Query]]&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&amp;#160;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Category: Database Query]]&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;

&lt;!-- diff cache key wikidb:diff:wikidiff2:1.12:old-3543:rev-3617:1.11.0 --&gt;
&lt;/table&gt;</summary>
		<author><name>Norwinu</name></author>
	</entry>
	<entry>
		<id>https://owl.unipharm.com/mediawiki/index.php?title=Information_Systems:Query/400&amp;diff=3543&amp;oldid=prev</id>
		<title>Norwinu at 07:24, 23 June 2016</title>
		<link rel="alternate" type="text/html" href="https://owl.unipharm.com/mediawiki/index.php?title=Information_Systems:Query/400&amp;diff=3543&amp;oldid=prev"/>
		<updated>2016-06-23T07:24:38Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left diff-editfont-monospace&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 07:24, 23 June 2016&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 404:&lt;/td&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 404:&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&amp;#160;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt; TO		year(work)* 10000 + month(work) * 100 + 31&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&amp;#160;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt; TO		year(work)* 10000 + month(work) * 100 + 31&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&amp;#160;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&amp;#160;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;−&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Category: Information Systems]]&lt;/div&gt;&lt;/td&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-empty&quot;&gt;&amp;#160;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&amp;#160;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Category: Database Query]]&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&amp;#160;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Category: Database Query]]&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;

&lt;!-- diff cache key wikidb:diff:wikidiff2:1.12:old-3533:rev-3543:1.11.0 --&gt;
&lt;/table&gt;</summary>
		<author><name>Norwinu</name></author>
	</entry>
	<entry>
		<id>https://owl.unipharm.com/mediawiki/index.php?title=Information_Systems:Query/400&amp;diff=3533&amp;oldid=prev</id>
		<title>Norwinu: Norwinu moved page Information Systems:QUERY to Information Systems:Query/400</title>
		<link rel="alternate" type="text/html" href="https://owl.unipharm.com/mediawiki/index.php?title=Information_Systems:Query/400&amp;diff=3533&amp;oldid=prev"/>
		<updated>2016-06-23T07:14:20Z</updated>

		<summary type="html">&lt;p&gt;Norwinu moved page &lt;a href=&quot;/mediawiki/index.php/Information_Systems:QUERY&quot; class=&quot;mw-redirect&quot; title=&quot;Information Systems:QUERY&quot;&gt;Information Systems:QUERY&lt;/a&gt; to &lt;a href=&quot;/mediawiki/index.php/Information_Systems:Query/400&quot; title=&quot;Information Systems:Query/400&quot;&gt;Information Systems:Query/400&lt;/a&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left diff-editfont-monospace&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 07:14, 23 June 2016&lt;/td&gt;
				&lt;/tr&gt;
&lt;!-- diff cache key wikidb:diff:wikidiff2:1.12:old-3532:rev-3533:1.11.0 --&gt;
&lt;/table&gt;</summary>
		<author><name>Norwinu</name></author>
	</entry>
	<entry>
		<id>https://owl.unipharm.com/mediawiki/index.php?title=Information_Systems:Query/400&amp;diff=3532&amp;oldid=prev</id>
		<title>Norwinu at 07:13, 23 June 2016</title>
		<link rel="alternate" type="text/html" href="https://owl.unipharm.com/mediawiki/index.php?title=Information_Systems:Query/400&amp;diff=3532&amp;oldid=prev"/>
		<updated>2016-06-23T07:13:46Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;=Query=&lt;br /&gt;
&lt;br /&gt;
‘Query’ is a tool to make an SQL call easier to define, and to use.  [[SQL|SQL (Structured Query Language)]] is a special purpose programming language designed for managing data held in a relational database management system (according to Wikipedia).  However, ‘Query’ only uses the input functions; not updating or deleting. &lt;br /&gt;
&lt;br /&gt;
On a command line in production ASW (so that you have the correct library list), key in  WRKQRY  and press enter.&lt;br /&gt;
&lt;br /&gt;
                               Work with Queries                                &lt;br /&gt;
                                                                                &lt;br /&gt;
 Type choices, press Enter.                                                     &lt;br /&gt;
                                                                                &lt;br /&gt;
   Option  . . . . . .   1              1=Create, 2=Change, 3=Copy, 4=Delete    &lt;br /&gt;
                                        5=Display, 6=Print definition           &lt;br /&gt;
                                        8=Run in batch, 9=Run                   &lt;br /&gt;
   Query . . . . . . .   test1          Name, F4 for list                       &lt;br /&gt;
     Library . . . . .     QTEMP        Name, *LIBL, F4 for list                &lt;br /&gt;
                                                                                 &lt;br /&gt;
 F3=Exit       F4=Prompt       F5=Refresh       F12=Cancel                      &lt;br /&gt;
                                                 (C) COPYRIGHT IBM CORP. 1988   &lt;br /&gt;
&lt;br /&gt;
Key in 1 to create a query, give it a meaningful name, and a library.  If this is for production, use XX2480BP; for your own use, put it in your work library; if it is one time only, use QTEMP (which will be removed when you log off).  Press enter.&lt;br /&gt;
&lt;br /&gt;
                                Define the Query                                &lt;br /&gt;
                                                                                &lt;br /&gt;
 Query . . . . . . :   TEST1             Option  . . . . . :   CREATE           &lt;br /&gt;
   Library . . . . :     QTEMP           CCSID . . . . . . :   65535            &lt;br /&gt;
                                                                                &lt;br /&gt;
 Type options, press Enter.  Press F21 to select all.                           &lt;br /&gt;
   1=Select                                                                     &lt;br /&gt;
                                                                                &lt;br /&gt;
 Opt    Query Definition Option                                                 &lt;br /&gt;
  1     Specify file selections                                                 &lt;br /&gt;
  _     Define result fields                                                    &lt;br /&gt;
  _     Select and sequence fields                                              &lt;br /&gt;
  _     Select records                                                          &lt;br /&gt;
  _     Select sort fields                                                      &lt;br /&gt;
  _     Select collating sequence                                               &lt;br /&gt;
  _     Specify report column formatting                                        &lt;br /&gt;
  _     Select report summary functions                                         &lt;br /&gt;
  _     Define report breaks                                                    &lt;br /&gt;
  _     Select output type and output form                                      &lt;br /&gt;
  _     Specify processing options                                              &lt;br /&gt;
                                                                                &lt;br /&gt;
 F3=Exit            F5=Report          F12=Cancel                               &lt;br /&gt;
 F13=Layout         F18=Files          F21=Select all                           &lt;br /&gt;
                                                                                &lt;br /&gt;
This is a list of the options you can use to build your query.  Key a ‘1’ in front of the option you want.  You can select all the options you want – at one time, or select them one at a time.&lt;br /&gt;
&lt;br /&gt;
Note that I am prefixing field names with the file ID.  This can be done when you select more than one input file, but only must be done then two files have the same field name.  &lt;br /&gt;
&lt;br /&gt;
All the screens have ‘help’ (alt-F1).  If there isn’t enough space on the screen for everything you want, you can press page down.&lt;br /&gt;
&lt;br /&gt;
==Specify file selections==&lt;br /&gt;
&lt;br /&gt;
                            Specify File Selections                             &lt;br /&gt;
                                                                                &lt;br /&gt;
 Type choices, press Enter.  Press F9 to specify an additional                  &lt;br /&gt;
   file selection.                                                              &lt;br /&gt;
                                                                                &lt;br /&gt;
   File . . . . . . . . .   XXITEMP        Name, F4 for list                    &lt;br /&gt;
     Library  . . . . . .     *LIBL        Name, *LIBL, F4 for list             &lt;br /&gt;
   Member . . . . . . . .   *FIRST         Name, *FIRST, F4 for list            &lt;br /&gt;
   Format . . . . . . . .   *FIRST         Name, *FIRST, F4 for list   &lt;br /&gt;
   File ID  . . . . . . .   T01            A-Z99, *ID   &lt;br /&gt;
  &lt;br /&gt;
   File . . . . . . . . .   srosro         Name, F4 for list              &lt;br /&gt;
      Library  . . . . . .     *LIBL        Name, *LIBL, F4 for list       &lt;br /&gt;
   Member . . . . . . . .   *FIRST         Name, *FIRST, F4 for list      &lt;br /&gt;
   Format . . . . . . . .   *FIRST         Name, *FIRST, F4 for list      &lt;br /&gt;
   File ID  . . . . . . .   T02            A-Z99, *ID                              &lt;br /&gt;
                                                                                 &lt;br /&gt;
 F3=Exit           F4=Prompt          F5=Report            F9=Add file          &lt;br /&gt;
 F12=Cancel        F13=Layout         F24=More keys                             &lt;br /&gt;
                                                                                &lt;br /&gt;
Key in the name of the file you want to use, clear the library (this will default to *LIBL, which will use your library list to find the file; which is why you run this from production ASW), and press enter.  You can press enter again, until you get back to the list of options, or press F9 to add another file (if, for example, you want to see item numbers, descriptions, and on hand quantities).  Press enter.&lt;br /&gt;
&lt;br /&gt;
                              Specify Type of Join                              &lt;br /&gt;
                                                                                &lt;br /&gt;
 Type choice, press Enter.                                                      &lt;br /&gt;
                                                                                &lt;br /&gt;
   Type of join . . . . . . . .   2      1=Matched records                      &lt;br /&gt;
                                         2=Matched records with primary file    &lt;br /&gt;
                                         3=Unmatched records with primary file  &lt;br /&gt;
                                                                                 &lt;br /&gt;
 F3=Exit            F5=Report           F10=Process/previous                    &lt;br /&gt;
 F12=Cancel         F13=Layout          F18=Files                               &lt;br /&gt;
                                                                                &lt;br /&gt;
‘2’ is the best choice here.  It will include every record in the first file, whether or not there is a matching record in the second file.  You can then select which records you want to use.  Press enter.&lt;br /&gt;
&lt;br /&gt;
                           Specify How to Join Files                            &lt;br /&gt;
                                                                                &lt;br /&gt;
 Type comparisons to show how file selections are related, press Enter.         &lt;br /&gt;
   Tests:  EQ, NE, LE, GE, LT, GT                                               &lt;br /&gt;
                                                                                &lt;br /&gt;
 Field             Test     Field                                               &lt;br /&gt;
 T01.ITPRDC        EQ       T02.SRPRDC_____                                   &lt;br /&gt;
 ______________    _____    _______________                                                                       &lt;br /&gt;
 ______________    _____    _______________                                                                       &lt;br /&gt;
 ______________    _____    _______________                                                                       &lt;br /&gt;
 ______________    _____    _______________                                                                                   &lt;br /&gt;
 ______________________________________________________________________________________          &lt;br /&gt;
 Field           Text                                                  Len  Dec &lt;br /&gt;
 T01.ITPRDC      Item #                                                 35      &lt;br /&gt;
 T01.ITDES1      Description 1                                          50      &lt;br /&gt;
 T01.ITDES2      Description 2                                          50      &lt;br /&gt;
 T01.ITDESC      Full Description                                      100      &lt;br /&gt;
 T01.ITTYPE      Type                                                    1      &lt;br /&gt;
                                                                       More...  &lt;br /&gt;
 F3=Exit       F5=Report      F10=Process/previous    F11=Display names only    &lt;br /&gt;
 F12=Cancel    F13=Layout     F18=Files               F24=More keys             &lt;br /&gt;
                                                                                &lt;br /&gt;
On the top part of this screen you define the link between the two files; in this case item number.  You can position your cursor to the bottom part of the screen, and press page down to see all the fields on both fields.  Press enter.&lt;br /&gt;
&lt;br /&gt;
==Define Result Fields==&lt;br /&gt;
&lt;br /&gt;
                              Define Result Fields                              &lt;br /&gt;
                                                                                &lt;br /&gt;
 Type definitions using field names or constants and operators, press Enter.    &lt;br /&gt;
   Operators:  +, -, *, /, SUBSTR, ||, DATE...                                  &lt;br /&gt;
                                                                                &lt;br /&gt;
 Field       Expression                         Column Heading        Len   Dec &lt;br /&gt;
 VALUE       T02.SRSTHQ * T02.SRAPCO            ___________________    __    __                                &lt;br /&gt;
             _________________________________  ___________________    &lt;br /&gt;
             _________________________________  ___________________&lt;br /&gt;
             _________________________________  ___________________&lt;br /&gt;
 _________   _________________________________  ___________________    __    __&lt;br /&gt;
             _________________________________  ___________________&lt;br /&gt;
             _________________________________  ___________________&lt;br /&gt;
             _________________________________  ___________________   &lt;br /&gt;
 ________________________________________________________________________________                                         &lt;br /&gt;
                                                                               &lt;br /&gt;
 Field           Text                                                  Len  Dec &lt;br /&gt;
 T02.SRSTHQ      Quantity on hand                                       15    3 &lt;br /&gt;
 T02.SRTSHQ      Transit stock on hand                                  15    3 &lt;br /&gt;
 T02.SRPURQ      Quantity on purchase order                             15    3 &lt;br /&gt;
 T02.SRRETQ      Quantity on return order                               15    3 &lt;br /&gt;
                                                                       More...  &lt;br /&gt;
 F3=Exit          F5=Report         F9=Insert          F11=Display names only   &lt;br /&gt;
 F12=Cancel       F13=Layout        F20=Reorganize     F24=More keys            &lt;br /&gt;
                                                                                &lt;br /&gt;
On the top of the screen, you can key in a calculation; in this case, the value is the on hand quantity times the average cost.  Again, you can position your cursor to the bottom part of the screen, and press page down to see all the fields on both fields.  Press enter.&lt;br /&gt;
&lt;br /&gt;
==Select and Sequence Fields==&lt;br /&gt;
&lt;br /&gt;
                          Select and Sequence Fields                            &lt;br /&gt;
                                                                                &lt;br /&gt;
 Type sequence number (0-9999) for the names of up to 500 fields to             &lt;br /&gt;
   appear in the report, press Enter.                                           &lt;br /&gt;
                                                                                &lt;br /&gt;
 Seq   Field             Text                                          Len  Dec &lt;br /&gt;
   10  T01.ITAGRP        Account Group                                   4      &lt;br /&gt;
   20  T01.ITTYPE        Type                                            1      &lt;br /&gt;
   30  T01.ITPRDC        Item #                                         35      &lt;br /&gt;
   40  T01.ITDESC        Full Description                              100      &lt;br /&gt;
   50  T01.ITSIZE        Size                                           15      &lt;br /&gt;
   60  T01.ITRESP        Buyer                                          10      &lt;br /&gt;
   70  T02.SRSROM        Warehouse number                                3      &lt;br /&gt;
   80  T02.SRSTHQ        Quantity on hand                               15    3 &lt;br /&gt;
   90  T02.SRAPCO        Average purchase cost                          17    4 &lt;br /&gt;
  100  VALUE             T02.SRSTHQ * T02.SRAPCO                        31    7 &lt;br /&gt;
       T01.ITDES1        Description 1                                  50      &lt;br /&gt;
       T01.ITDES2        Description 2                                  50      &lt;br /&gt;
                                                                                &lt;br /&gt;
 F3=Exit          F5=Report         F11=Display names only    F12=Cancel        &lt;br /&gt;
 F13=Layout       F20=Renumber      F21=Select all            F24=More keys     &lt;br /&gt;
&lt;br /&gt;
Key in a sequence number for the fields you want to include.  Page down to see all the fields available.  Press enter.&lt;br /&gt;
&lt;br /&gt;
==Select Records==&lt;br /&gt;
&lt;br /&gt;
                                 Select Records                                 &lt;br /&gt;
                                                                                &lt;br /&gt;
 Type comparisons, press Enter.  Specify OR to start each new group.            &lt;br /&gt;
   Tests:  EQ, NE, LE, GE, LT, GT, RANGE, LIST, LIKE, IS, ISNOT...              &lt;br /&gt;
                                                                                &lt;br /&gt;
 AND/OR  Field             Test   Value (Field, Number, 'Characters', or ...)   &lt;br /&gt;
         T02.SRSTHQ        NE     0_____________________________                                             &lt;br /&gt;
  AND    T02.SRSROM        EQ     'MAI'_________________________                                         &lt;br /&gt;
  ____   ______________    ____   ______________________________&lt;br /&gt;
  ____   ______________    ____   ______________________________&lt;br /&gt;
  ____   ______________    ____   ______________________________ &lt;br /&gt;
  ____   ______________    ____   ______________________________&lt;br /&gt;
 __________________________________________________________________________________&lt;br /&gt;
 Field           Text                                                  Len  Dec &lt;br /&gt;
 T01.ITAGRP      Account Group                                           4   &lt;br /&gt;
 T01.ITTYPE      Type                                                    1   &lt;br /&gt;
 T01.ITPRDC      Item #                                                 35   &lt;br /&gt;
 T01.ITDESC      Full Description                                      100   &lt;br /&gt;
 T01.ITSIZE      Size                                                   15&lt;br /&gt;
 F3=Exit          F5=Report          F9=Insert          F11=Display names only  &lt;br /&gt;
 F12=Cancel       F13=Layout         F20=Reorganize     F24=More keys           &lt;br /&gt;
                                                                                &lt;br /&gt;
Define which records are to be included.  Here I am saying all items with quantities in the Main warehouse.&lt;br /&gt;
&lt;br /&gt;
==Select Sort Fields==&lt;br /&gt;
&lt;br /&gt;
                               Select Sort Fields                               &lt;br /&gt;
                                                                                &lt;br /&gt;
 Type sort priority (0-999) and A (Ascending) or D (Descending) for             &lt;br /&gt;
   the names of up to 32 fields, press Enter.                                   &lt;br /&gt;
                                                                                &lt;br /&gt;
 Sort                                                                           &lt;br /&gt;
 Prty A/D  Field           Text                                        Len  Dec &lt;br /&gt;
    1  A   T01.ITAGRP      Account Group                                 4      &lt;br /&gt;
    2  D   VALUE           T02.SRSTHQ * T02.SRAPCO                      31    7 &lt;br /&gt;
  ___  _   T01.ITTYPE      Type                                          1      &lt;br /&gt;
  ___  _   T01.ITPRDC      Item #                                       35      &lt;br /&gt;
  ___  _   T01.ITDESC      Full Description                            100      &lt;br /&gt;
  ___  _   T01.ITSIZE      Size                                         15      &lt;br /&gt;
  ___  _   T01.ITRESP      Buyer                                        10      &lt;br /&gt;
  ___  _   T02.SRSROM      Warehouse number                              3      &lt;br /&gt;
  ___  _   T02.SRSTHQ      Quantity on hand                             15    3 &lt;br /&gt;
  ___  _   T02.SRAPCO      Average purchase cost                        17    4&lt;br /&gt;
   &lt;br /&gt;
 F3=Exit            F5=Report       F11=Display names only   F12=Cancel         &lt;br /&gt;
 F13=Layout         F18=Files       F20=Renumber             F24=More keys      &lt;br /&gt;
&lt;br /&gt;
This will show items in order by item account group, and within that, by highest value first.  Press enter.&lt;br /&gt;
&lt;br /&gt;
==Specify Report Column Formatting==&lt;br /&gt;
&lt;br /&gt;
                        Specify Report Column Formatting                        &lt;br /&gt;
                                                                                &lt;br /&gt;
 Type information, press Enter.                                                 &lt;br /&gt;
   Column headings:  *NONE, aligned text lines                                  &lt;br /&gt;
                                                                                &lt;br /&gt;
                   Column                                                       &lt;br /&gt;
 Field             Spacing       Column Heading               Len  Dec   Edit   &lt;br /&gt;
 T01.ITAGRP           0          Account                        4   __            &lt;br /&gt;
                                 Group___________________                                          &lt;br /&gt;
                                 ________________________                                               &lt;br /&gt;
                                                                                &lt;br /&gt;
 T01.ITTYPE           2          Type                           1   __          &lt;br /&gt;
                                 ________________________                                               &lt;br /&gt;
                                 ________________________                                               &lt;br /&gt;
                                                                                &lt;br /&gt;
 T01.ITPRDC           2          Item #                         8   __               &lt;br /&gt;
                                 ________________________                                               &lt;br /&gt;
                                 ________________________                                               &lt;br /&gt;
                                                                                &lt;br /&gt;
                                                                                &lt;br /&gt;
 F3=Exit         F5=Report       F10=Process/previous     F12=Cancel            &lt;br /&gt;
 F13=Layout      F16=Edit        F18=Files                F23=Long comment      &lt;br /&gt;
                                                                                &lt;br /&gt;
You can change how the display, or report, will look.  Here, I changed the heading from ‘VALUE’ to ‘Value’, and made the field lengths smaller.  As Value was the result of a calculation, its field length and number of decimals was based on the on hand and average cost fields.  It will never be that large, so it can be shortened for the report.  ASW defines the item number field as 35 characters long, but we only use 8.  Press enter.&lt;br /&gt;
&lt;br /&gt;
==Select Report Summary Functions==&lt;br /&gt;
&lt;br /&gt;
                        Select Report Summary Functions                         &lt;br /&gt;
                                                                                &lt;br /&gt;
 Type options, press Enter.                                                     &lt;br /&gt;
   1=Total   2=Average   3=Minimum   4=Maximum   5=Count                        &lt;br /&gt;
                                                                                &lt;br /&gt;
 ---Options---  Field           Text                                   Len  Dec &lt;br /&gt;
 _  _  _  _  _  T01.ITAGRP      Account Group                            4      &lt;br /&gt;
 _  _  _  _  _  T01.ITTYPE      Type                                     1      &lt;br /&gt;
 5  _  _  _  _  T01.ITPRDC      Item #                                   8      &lt;br /&gt;
 _  _  _  _  _  T01.ITDESC      Full Description                       100      &lt;br /&gt;
 _  _  _  _  _  T01.ITSIZE      Size                                    15      &lt;br /&gt;
 _  _  _  _  _  T01.ITRESP      Buyer                                   10&lt;br /&gt;
 _  _  _  _  _  T02.SRSROM      Warehouse number                         3&lt;br /&gt;
 _  _  _  _  _  T02.SRSTHQ      Quantity on hand                        15    3&lt;br /&gt;
 _  _  _  _  _  T02.SRAPCO      Average purchase cost                   17    4&lt;br /&gt;
 1  4  _  _  _  VALUE           T02.SRSTHQ * T02.SRAPCO                  9    2 &lt;br /&gt;
                                                                                &lt;br /&gt;
                                                                                &lt;br /&gt;
 F3=Exit       F5=Report       F10=Process/previous    F11=Display names only   &lt;br /&gt;
 F12=Cancel    F13=Layout      F18=Files               F23=Long comment         &lt;br /&gt;
                                                                                &lt;br /&gt;
I am saying that I want a count of how many items are on the list, the total value, and the highest individual total.&lt;br /&gt;
&lt;br /&gt;
==Define Report Breaks==&lt;br /&gt;
&lt;br /&gt;
                              Define Report Breaks                              &lt;br /&gt;
                                                                                &lt;br /&gt;
 Type break level (1-6) for up to 9 field names, press Enter.                   &lt;br /&gt;
   (Use as many fields as needed for each break level.)                         &lt;br /&gt;
                                                                                &lt;br /&gt;
 Break    Sort                                                                  &lt;br /&gt;
 Level    Prty  Field           Text                                   Len  Dec &lt;br /&gt;
   1        10  T01.ITAGRP      Account Group                            4      &lt;br /&gt;
   _            T01.ITTYPE      Type                                     1      &lt;br /&gt;
   _            T01.ITPRDC      Item #                                   8      &lt;br /&gt;
   _            T01.ITDESC      Full Description                       100      &lt;br /&gt;
   _            T01.ITSIZE      Size                                    15      &lt;br /&gt;
   _            T01.ITRESP      Buyer                                   10      &lt;br /&gt;
   _            T02.SRSROM      Warehouse number                         3      &lt;br /&gt;
   _            T02.SRSTHQ      Quantity on hand                        15    3 &lt;br /&gt;
   _            T02.SRAPCO      Average purchase cost                   17    4 &lt;br /&gt;
   _        20  VALUE           T02.SRSTHQ * T02.SRAPCO                  9    2 &lt;br /&gt;
                                                                                &lt;br /&gt;
 F3=Exit        F5=Report      F10=Process/previous    F11=Display names only   &lt;br /&gt;
 F12=Cancel     F13=Layout     F18=Files               F23=Long comment         &lt;br /&gt;
                                                                                &lt;br /&gt;
I want totals by item account group; as well as final totals.  Press enter until back to the list of options.&lt;br /&gt;
&lt;br /&gt;
==Special Output Type and Output Form==&lt;br /&gt;
&lt;br /&gt;
This is how to create a data file, which can be used as input to another Query, or to create a CSV file.&lt;br /&gt;
&lt;br /&gt;
                        Select Output Type and Output Form                       &lt;br /&gt;
                                                                                &lt;br /&gt;
 Type choices, press Enter.                                                     &lt;br /&gt;
                                                                                &lt;br /&gt;
   Output type  . . . . . . . . . . .   3     1=Display                         &lt;br /&gt;
                                              2=Printer                         &lt;br /&gt;
                                              3=Database file                   &lt;br /&gt;
                                                                                &lt;br /&gt;
   Form of output . . . . . . . . . .   1     1=Detail                          &lt;br /&gt;
                                              2=Summary only                    &lt;br /&gt;
                                                                                &lt;br /&gt;
   Line wrapping  . . . . . . . . . .   N     Y=Yes, N=No                       &lt;br /&gt;
     Wrapping width . . . . . . . . .         Blank, 1-378                      &lt;br /&gt;
     Record on one page . . . . . . .   N     Y=Yes, N=No                       &lt;br /&gt;
                                                                                &lt;br /&gt;
                                                                                &lt;br /&gt;
 F3=Exit           F5=Report           F10=Process/previous                     &lt;br /&gt;
 F12=Cancel        F13=Layout          F18=Files                                &lt;br /&gt;
     &lt;br /&gt;
‘Output type’ is 3 to create a file.  ‘Form of output’ is 1 to write all the detail records to the file, or 2 to only write the totals and subtotals (the defined report breaks).&lt;br /&gt;
                                                                           &lt;br /&gt;
                          Define Database File Output                           &lt;br /&gt;
                                                                                &lt;br /&gt;
 Type choices, press Enter.                                                     &lt;br /&gt;
   (The printed definition shows the output file record layout.)                &lt;br /&gt;
                                                                                &lt;br /&gt;
   File . . . . . . . . .   testfile       Name, F4 for list                    &lt;br /&gt;
     Library  . . . . . .     QTEMP        Name, F4 for list                    &lt;br /&gt;
   Member . . . . . . . .   *FILE          Name, *FIRST, *FILE, *ALL,           &lt;br /&gt;
                                           F4 for list                          &lt;br /&gt;
   Data in file . . . . .   2              1=New file, 2=Replace file           &lt;br /&gt;
                                           3=New member, 4=Replace member       &lt;br /&gt;
                                           5=Add to member                      &lt;br /&gt;
                                                                                &lt;br /&gt;
   For a new file:                                                              &lt;br /&gt;
     Authority  . . . . .   *LIBCRTAUT     *LIBCRTAUT, authorization list name, &lt;br /&gt;
                                           *CHANGE, *ALL, *EXCLUDE, *USE        &lt;br /&gt;
                                                                                &lt;br /&gt;
                                                                                &lt;br /&gt;
     Text . . . . . . . .   test file_________________________________________                                           &lt;br /&gt;
   Print definition . . .   N              Y=Yes, N=No                          &lt;br /&gt;
                                                                                &lt;br /&gt;
 F3=Exit          F4=Prompt        F5=Report          F10=Process/previous      &lt;br /&gt;
 F12=Cancel       F13=Layout       F18=Files                                    &lt;br /&gt;
  &lt;br /&gt;
Give the file a meaningful name and text.  If you want to keep this file for production, use library UP1480BFVA or UWDASWPRDD; for your own use, put it in your work library; if it is one time only, use QTEMP (which will be removed when you log off).  Be VERY careful not the name of a file that already exists; because you will replace it!  Press enter.&lt;br /&gt;
                                                                     &lt;br /&gt;
If you want to print a report – &lt;br /&gt;
&lt;br /&gt;
                        Select Output Type and Output Form                       &lt;br /&gt;
                                                                                &lt;br /&gt;
 Type choices, press Enter.                                                     &lt;br /&gt;
                                                                                &lt;br /&gt;
   Output type  . . . . . . . . . . .   2     1=Display                         &lt;br /&gt;
                                              2=Printer                         &lt;br /&gt;
                                              3=Database file                   &lt;br /&gt;
                                                                                &lt;br /&gt;
   Form of output . . . . . . . . . .   1     1=Detail                          &lt;br /&gt;
                                              2=Summary only                    &lt;br /&gt;
                                                                                &lt;br /&gt;
   Line wrapping  . . . . . . . . . .   N     Y=Yes, N=No                       &lt;br /&gt;
     Wrapping width . . . . . . . . .         Blank, 1-378                      &lt;br /&gt;
     Record on one page . . . . . . .   N     Y=Yes, N=No                       &lt;br /&gt;
                                                                                &lt;br /&gt;
                                                                                &lt;br /&gt;
 F3=Exit           F5=Report           F10=Process/previous                     &lt;br /&gt;
 F12=Cancel        F13=Layout          F18=Files                                &lt;br /&gt;
&lt;br /&gt;
                             Define Printer Output                              &lt;br /&gt;
                                                                                &lt;br /&gt;
 Type choices, press Enter.                                                     &lt;br /&gt;
                                                                                &lt;br /&gt;
   Printer  . . . . . . . . .   *PRINT       *PRINT, name                       &lt;br /&gt;
                                                                                &lt;br /&gt;
   Form size:                                                                   &lt;br /&gt;
     Length . . . . . . . . .                Blank, 1-255                       &lt;br /&gt;
     Width  . . . . . . . . .   132          Blank, 1-378                       &lt;br /&gt;
                                                                                &lt;br /&gt;
   Start line . . . . . . . .                Blank, 1-255                       &lt;br /&gt;
                                                                                &lt;br /&gt;
   End line . . . . . . . . .                Blank, 1-255                       &lt;br /&gt;
                                                                                &lt;br /&gt;
   Line spacing . . . . . . .   1            1, 2, 3                            &lt;br /&gt;
                                                                                &lt;br /&gt;
   Print definition . . . . .   N            Y=Yes, N=No                        &lt;br /&gt;
                                                                                &lt;br /&gt;
 F3=Exit           F5=Report           F10=Process/previous                     &lt;br /&gt;
 F12=Cancel        F13=Layout          F18=Files                                &lt;br /&gt;
                                                                                &lt;br /&gt;
The form width depends on how much data you are including (you can see by pressing F13 to show the layout).  If you can go as low as 80 the report will print in portrait, with a larger font.&lt;br /&gt;
&lt;br /&gt;
==Notes==&lt;br /&gt;
&lt;br /&gt;
To get the current date – &lt;br /&gt;
&lt;br /&gt;
 WORK	current(date)&lt;br /&gt;
&lt;br /&gt;
To get last month’s date (not exactly, as months can be from 28 to 31 days; so this only works up to the 29th) – &lt;br /&gt;
&lt;br /&gt;
 WORK	date(days(current(date))-28)&lt;br /&gt;
&lt;br /&gt;
To build from and to dates to search for records dated the previous month (the ‘TO’ value won’t always be correct, but it will work) – &lt;br /&gt;
&lt;br /&gt;
 FROM		year(work)* 10000 + month(work) * 100 + 01              &lt;br /&gt;
 TO		year(work)* 10000 + month(work) * 100 + 31&lt;br /&gt;
&lt;br /&gt;
[[Category: Information Systems]]&lt;br /&gt;
[[Category: Database Query]]&lt;/div&gt;</summary>
		<author><name>Norwinu</name></author>
	</entry>
	<entry>
		<id>https://owl.unipharm.com/mediawiki/index.php?title=Information_Systems:Query/400&amp;diff=1074&amp;oldid=prev</id>
		<title>Sheilav at 21:44, 30 October 2015</title>
		<link rel="alternate" type="text/html" href="https://owl.unipharm.com/mediawiki/index.php?title=Information_Systems:Query/400&amp;diff=1074&amp;oldid=prev"/>
		<updated>2015-10-30T21:44:44Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left diff-editfont-monospace&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 21:44, 30 October 2015&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-empty&quot;&gt;&amp;#160;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;+&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=Query=&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-empty&quot;&gt;&amp;#160;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;+&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&amp;#160;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;‘Query’ is a tool to make an SQL call easier to define, and to use.  [[SQL|SQL (Structured Query Language)]] is a special purpose programming language designed for managing data held in a relational database management system (according to Wikipedia).  However, ‘Query’ only uses the input functions; not updating or deleting. &lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&amp;#160;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;‘Query’ is a tool to make an SQL call easier to define, and to use.  [[SQL|SQL (Structured Query Language)]] is a special purpose programming language designed for managing data held in a relational database management system (according to Wikipedia).  However, ‘Query’ only uses the input functions; not updating or deleting. &lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&amp;#160;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&amp;#160;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;
&lt;/tr&gt;

&lt;!-- diff cache key wikidb:diff:wikidiff2:1.12:old-1073:rev-1074:1.11.0 --&gt;
&lt;/table&gt;</summary>
		<author><name>Sheilav</name></author>
	</entry>
	<entry>
		<id>https://owl.unipharm.com/mediawiki/index.php?title=Information_Systems:Query/400&amp;diff=1073&amp;oldid=prev</id>
		<title>Sheilav: Created page with &quot;‘Query’ is a tool to make an SQL call easier to define, and to use.  SQL (Structured Query Language) is a special purpose programming language designed for managin...&quot;</title>
		<link rel="alternate" type="text/html" href="https://owl.unipharm.com/mediawiki/index.php?title=Information_Systems:Query/400&amp;diff=1073&amp;oldid=prev"/>
		<updated>2015-10-30T21:43:55Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;‘Query’ is a tool to make an SQL call easier to define, and to use.  &lt;a href=&quot;/mediawiki/index.php/SQL&quot; class=&quot;mw-redirect&quot; title=&quot;SQL&quot;&gt;SQL (Structured Query Language)&lt;/a&gt; is a special purpose programming language designed for managin...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;‘Query’ is a tool to make an SQL call easier to define, and to use.  [[SQL|SQL (Structured Query Language)]] is a special purpose programming language designed for managing data held in a relational database management system (according to Wikipedia).  However, ‘Query’ only uses the input functions; not updating or deleting. &lt;br /&gt;
&lt;br /&gt;
On a command line in production ASW (so that you have the correct library list), key in  WRKQRY  and press enter.&lt;br /&gt;
&lt;br /&gt;
                               Work with Queries                                &lt;br /&gt;
                                                                                &lt;br /&gt;
 Type choices, press Enter.                                                     &lt;br /&gt;
                                                                                &lt;br /&gt;
   Option  . . . . . .   1              1=Create, 2=Change, 3=Copy, 4=Delete    &lt;br /&gt;
                                        5=Display, 6=Print definition           &lt;br /&gt;
                                        8=Run in batch, 9=Run                   &lt;br /&gt;
   Query . . . . . . .   test1          Name, F4 for list                       &lt;br /&gt;
     Library . . . . .     QTEMP        Name, *LIBL, F4 for list                &lt;br /&gt;
                                                                                 &lt;br /&gt;
 F3=Exit       F4=Prompt       F5=Refresh       F12=Cancel                      &lt;br /&gt;
                                                 (C) COPYRIGHT IBM CORP. 1988   &lt;br /&gt;
&lt;br /&gt;
Key in 1 to create a query, give it a meaningful name, and a library.  If this is for production, use XX2480BP; for your own use, put it in your work library; if it is one time only, use QTEMP (which will be removed when you log off).  Press enter.&lt;br /&gt;
&lt;br /&gt;
                                Define the Query                                &lt;br /&gt;
                                                                                &lt;br /&gt;
 Query . . . . . . :   TEST1             Option  . . . . . :   CREATE           &lt;br /&gt;
   Library . . . . :     QTEMP           CCSID . . . . . . :   65535            &lt;br /&gt;
                                                                                &lt;br /&gt;
 Type options, press Enter.  Press F21 to select all.                           &lt;br /&gt;
   1=Select                                                                     &lt;br /&gt;
                                                                                &lt;br /&gt;
 Opt    Query Definition Option                                                 &lt;br /&gt;
  1     Specify file selections                                                 &lt;br /&gt;
  _     Define result fields                                                    &lt;br /&gt;
  _     Select and sequence fields                                              &lt;br /&gt;
  _     Select records                                                          &lt;br /&gt;
  _     Select sort fields                                                      &lt;br /&gt;
  _     Select collating sequence                                               &lt;br /&gt;
  _     Specify report column formatting                                        &lt;br /&gt;
  _     Select report summary functions                                         &lt;br /&gt;
  _     Define report breaks                                                    &lt;br /&gt;
  _     Select output type and output form                                      &lt;br /&gt;
  _     Specify processing options                                              &lt;br /&gt;
                                                                                &lt;br /&gt;
 F3=Exit            F5=Report          F12=Cancel                               &lt;br /&gt;
 F13=Layout         F18=Files          F21=Select all                           &lt;br /&gt;
                                                                                &lt;br /&gt;
This is a list of the options you can use to build your query.  Key a ‘1’ in front of the option you want.  You can select all the options you want – at one time, or select them one at a time.&lt;br /&gt;
&lt;br /&gt;
Note that I am prefixing field names with the file ID.  This can be done when you select more than one input file, but only must be done then two files have the same field name.  &lt;br /&gt;
&lt;br /&gt;
All the screens have ‘help’ (alt-F1).  If there isn’t enough space on the screen for everything you want, you can press page down.&lt;br /&gt;
&lt;br /&gt;
==Specify file selections==&lt;br /&gt;
&lt;br /&gt;
                            Specify File Selections                             &lt;br /&gt;
                                                                                &lt;br /&gt;
 Type choices, press Enter.  Press F9 to specify an additional                  &lt;br /&gt;
   file selection.                                                              &lt;br /&gt;
                                                                                &lt;br /&gt;
   File . . . . . . . . .   XXITEMP        Name, F4 for list                    &lt;br /&gt;
     Library  . . . . . .     *LIBL        Name, *LIBL, F4 for list             &lt;br /&gt;
   Member . . . . . . . .   *FIRST         Name, *FIRST, F4 for list            &lt;br /&gt;
   Format . . . . . . . .   *FIRST         Name, *FIRST, F4 for list   &lt;br /&gt;
   File ID  . . . . . . .   T01            A-Z99, *ID   &lt;br /&gt;
  &lt;br /&gt;
   File . . . . . . . . .   srosro         Name, F4 for list              &lt;br /&gt;
      Library  . . . . . .     *LIBL        Name, *LIBL, F4 for list       &lt;br /&gt;
   Member . . . . . . . .   *FIRST         Name, *FIRST, F4 for list      &lt;br /&gt;
   Format . . . . . . . .   *FIRST         Name, *FIRST, F4 for list      &lt;br /&gt;
   File ID  . . . . . . .   T02            A-Z99, *ID                              &lt;br /&gt;
                                                                                 &lt;br /&gt;
 F3=Exit           F4=Prompt          F5=Report            F9=Add file          &lt;br /&gt;
 F12=Cancel        F13=Layout         F24=More keys                             &lt;br /&gt;
                                                                                &lt;br /&gt;
Key in the name of the file you want to use, clear the library (this will default to *LIBL, which will use your library list to find the file; which is why you run this from production ASW), and press enter.  You can press enter again, until you get back to the list of options, or press F9 to add another file (if, for example, you want to see item numbers, descriptions, and on hand quantities).  Press enter.&lt;br /&gt;
&lt;br /&gt;
                              Specify Type of Join                              &lt;br /&gt;
                                                                                &lt;br /&gt;
 Type choice, press Enter.                                                      &lt;br /&gt;
                                                                                &lt;br /&gt;
   Type of join . . . . . . . .   2      1=Matched records                      &lt;br /&gt;
                                         2=Matched records with primary file    &lt;br /&gt;
                                         3=Unmatched records with primary file  &lt;br /&gt;
                                                                                 &lt;br /&gt;
 F3=Exit            F5=Report           F10=Process/previous                    &lt;br /&gt;
 F12=Cancel         F13=Layout          F18=Files                               &lt;br /&gt;
                                                                                &lt;br /&gt;
‘2’ is the best choice here.  It will include every record in the first file, whether or not there is a matching record in the second file.  You can then select which records you want to use.  Press enter.&lt;br /&gt;
&lt;br /&gt;
                           Specify How to Join Files                            &lt;br /&gt;
                                                                                &lt;br /&gt;
 Type comparisons to show how file selections are related, press Enter.         &lt;br /&gt;
   Tests:  EQ, NE, LE, GE, LT, GT                                               &lt;br /&gt;
                                                                                &lt;br /&gt;
 Field             Test     Field                                               &lt;br /&gt;
 T01.ITPRDC        EQ       T02.SRPRDC_____                                   &lt;br /&gt;
 ______________    _____    _______________                                                                       &lt;br /&gt;
 ______________    _____    _______________                                                                       &lt;br /&gt;
 ______________    _____    _______________                                                                       &lt;br /&gt;
 ______________    _____    _______________                                                                                   &lt;br /&gt;
 ______________________________________________________________________________________          &lt;br /&gt;
 Field           Text                                                  Len  Dec &lt;br /&gt;
 T01.ITPRDC      Item #                                                 35      &lt;br /&gt;
 T01.ITDES1      Description 1                                          50      &lt;br /&gt;
 T01.ITDES2      Description 2                                          50      &lt;br /&gt;
 T01.ITDESC      Full Description                                      100      &lt;br /&gt;
 T01.ITTYPE      Type                                                    1      &lt;br /&gt;
                                                                       More...  &lt;br /&gt;
 F3=Exit       F5=Report      F10=Process/previous    F11=Display names only    &lt;br /&gt;
 F12=Cancel    F13=Layout     F18=Files               F24=More keys             &lt;br /&gt;
                                                                                &lt;br /&gt;
On the top part of this screen you define the link between the two files; in this case item number.  You can position your cursor to the bottom part of the screen, and press page down to see all the fields on both fields.  Press enter.&lt;br /&gt;
&lt;br /&gt;
==Define Result Fields==&lt;br /&gt;
&lt;br /&gt;
                              Define Result Fields                              &lt;br /&gt;
                                                                                &lt;br /&gt;
 Type definitions using field names or constants and operators, press Enter.    &lt;br /&gt;
   Operators:  +, -, *, /, SUBSTR, ||, DATE...                                  &lt;br /&gt;
                                                                                &lt;br /&gt;
 Field       Expression                         Column Heading        Len   Dec &lt;br /&gt;
 VALUE       T02.SRSTHQ * T02.SRAPCO            ___________________    __    __                                &lt;br /&gt;
             _________________________________  ___________________    &lt;br /&gt;
             _________________________________  ___________________&lt;br /&gt;
             _________________________________  ___________________&lt;br /&gt;
 _________   _________________________________  ___________________    __    __&lt;br /&gt;
             _________________________________  ___________________&lt;br /&gt;
             _________________________________  ___________________&lt;br /&gt;
             _________________________________  ___________________   &lt;br /&gt;
 ________________________________________________________________________________                                         &lt;br /&gt;
                                                                               &lt;br /&gt;
 Field           Text                                                  Len  Dec &lt;br /&gt;
 T02.SRSTHQ      Quantity on hand                                       15    3 &lt;br /&gt;
 T02.SRTSHQ      Transit stock on hand                                  15    3 &lt;br /&gt;
 T02.SRPURQ      Quantity on purchase order                             15    3 &lt;br /&gt;
 T02.SRRETQ      Quantity on return order                               15    3 &lt;br /&gt;
                                                                       More...  &lt;br /&gt;
 F3=Exit          F5=Report         F9=Insert          F11=Display names only   &lt;br /&gt;
 F12=Cancel       F13=Layout        F20=Reorganize     F24=More keys            &lt;br /&gt;
                                                                                &lt;br /&gt;
On the top of the screen, you can key in a calculation; in this case, the value is the on hand quantity times the average cost.  Again, you can position your cursor to the bottom part of the screen, and press page down to see all the fields on both fields.  Press enter.&lt;br /&gt;
&lt;br /&gt;
==Select and Sequence Fields==&lt;br /&gt;
&lt;br /&gt;
                          Select and Sequence Fields                            &lt;br /&gt;
                                                                                &lt;br /&gt;
 Type sequence number (0-9999) for the names of up to 500 fields to             &lt;br /&gt;
   appear in the report, press Enter.                                           &lt;br /&gt;
                                                                                &lt;br /&gt;
 Seq   Field             Text                                          Len  Dec &lt;br /&gt;
   10  T01.ITAGRP        Account Group                                   4      &lt;br /&gt;
   20  T01.ITTYPE        Type                                            1      &lt;br /&gt;
   30  T01.ITPRDC        Item #                                         35      &lt;br /&gt;
   40  T01.ITDESC        Full Description                              100      &lt;br /&gt;
   50  T01.ITSIZE        Size                                           15      &lt;br /&gt;
   60  T01.ITRESP        Buyer                                          10      &lt;br /&gt;
   70  T02.SRSROM        Warehouse number                                3      &lt;br /&gt;
   80  T02.SRSTHQ        Quantity on hand                               15    3 &lt;br /&gt;
   90  T02.SRAPCO        Average purchase cost                          17    4 &lt;br /&gt;
  100  VALUE             T02.SRSTHQ * T02.SRAPCO                        31    7 &lt;br /&gt;
       T01.ITDES1        Description 1                                  50      &lt;br /&gt;
       T01.ITDES2        Description 2                                  50      &lt;br /&gt;
                                                                                &lt;br /&gt;
 F3=Exit          F5=Report         F11=Display names only    F12=Cancel        &lt;br /&gt;
 F13=Layout       F20=Renumber      F21=Select all            F24=More keys     &lt;br /&gt;
&lt;br /&gt;
Key in a sequence number for the fields you want to include.  Page down to see all the fields available.  Press enter.&lt;br /&gt;
&lt;br /&gt;
==Select Records==&lt;br /&gt;
&lt;br /&gt;
                                 Select Records                                 &lt;br /&gt;
                                                                                &lt;br /&gt;
 Type comparisons, press Enter.  Specify OR to start each new group.            &lt;br /&gt;
   Tests:  EQ, NE, LE, GE, LT, GT, RANGE, LIST, LIKE, IS, ISNOT...              &lt;br /&gt;
                                                                                &lt;br /&gt;
 AND/OR  Field             Test   Value (Field, Number, 'Characters', or ...)   &lt;br /&gt;
         T02.SRSTHQ        NE     0_____________________________                                             &lt;br /&gt;
  AND    T02.SRSROM        EQ     'MAI'_________________________                                         &lt;br /&gt;
  ____   ______________    ____   ______________________________&lt;br /&gt;
  ____   ______________    ____   ______________________________&lt;br /&gt;
  ____   ______________    ____   ______________________________ &lt;br /&gt;
  ____   ______________    ____   ______________________________&lt;br /&gt;
 __________________________________________________________________________________&lt;br /&gt;
 Field           Text                                                  Len  Dec &lt;br /&gt;
 T01.ITAGRP      Account Group                                           4   &lt;br /&gt;
 T01.ITTYPE      Type                                                    1   &lt;br /&gt;
 T01.ITPRDC      Item #                                                 35   &lt;br /&gt;
 T01.ITDESC      Full Description                                      100   &lt;br /&gt;
 T01.ITSIZE      Size                                                   15&lt;br /&gt;
 F3=Exit          F5=Report          F9=Insert          F11=Display names only  &lt;br /&gt;
 F12=Cancel       F13=Layout         F20=Reorganize     F24=More keys           &lt;br /&gt;
                                                                                &lt;br /&gt;
Define which records are to be included.  Here I am saying all items with quantities in the Main warehouse.&lt;br /&gt;
&lt;br /&gt;
==Select Sort Fields==&lt;br /&gt;
&lt;br /&gt;
                               Select Sort Fields                               &lt;br /&gt;
                                                                                &lt;br /&gt;
 Type sort priority (0-999) and A (Ascending) or D (Descending) for             &lt;br /&gt;
   the names of up to 32 fields, press Enter.                                   &lt;br /&gt;
                                                                                &lt;br /&gt;
 Sort                                                                           &lt;br /&gt;
 Prty A/D  Field           Text                                        Len  Dec &lt;br /&gt;
    1  A   T01.ITAGRP      Account Group                                 4      &lt;br /&gt;
    2  D   VALUE           T02.SRSTHQ * T02.SRAPCO                      31    7 &lt;br /&gt;
  ___  _   T01.ITTYPE      Type                                          1      &lt;br /&gt;
  ___  _   T01.ITPRDC      Item #                                       35      &lt;br /&gt;
  ___  _   T01.ITDESC      Full Description                            100      &lt;br /&gt;
  ___  _   T01.ITSIZE      Size                                         15      &lt;br /&gt;
  ___  _   T01.ITRESP      Buyer                                        10      &lt;br /&gt;
  ___  _   T02.SRSROM      Warehouse number                              3      &lt;br /&gt;
  ___  _   T02.SRSTHQ      Quantity on hand                             15    3 &lt;br /&gt;
  ___  _   T02.SRAPCO      Average purchase cost                        17    4&lt;br /&gt;
   &lt;br /&gt;
 F3=Exit            F5=Report       F11=Display names only   F12=Cancel         &lt;br /&gt;
 F13=Layout         F18=Files       F20=Renumber             F24=More keys      &lt;br /&gt;
&lt;br /&gt;
This will show items in order by item account group, and within that, by highest value first.  Press enter.&lt;br /&gt;
&lt;br /&gt;
==Specify Report Column Formatting==&lt;br /&gt;
&lt;br /&gt;
                        Specify Report Column Formatting                        &lt;br /&gt;
                                                                                &lt;br /&gt;
 Type information, press Enter.                                                 &lt;br /&gt;
   Column headings:  *NONE, aligned text lines                                  &lt;br /&gt;
                                                                                &lt;br /&gt;
                   Column                                                       &lt;br /&gt;
 Field             Spacing       Column Heading               Len  Dec   Edit   &lt;br /&gt;
 T01.ITAGRP           0          Account                        4   __            &lt;br /&gt;
                                 Group___________________                                          &lt;br /&gt;
                                 ________________________                                               &lt;br /&gt;
                                                                                &lt;br /&gt;
 T01.ITTYPE           2          Type                           1   __          &lt;br /&gt;
                                 ________________________                                               &lt;br /&gt;
                                 ________________________                                               &lt;br /&gt;
                                                                                &lt;br /&gt;
 T01.ITPRDC           2          Item #                         8   __               &lt;br /&gt;
                                 ________________________                                               &lt;br /&gt;
                                 ________________________                                               &lt;br /&gt;
                                                                                &lt;br /&gt;
                                                                                &lt;br /&gt;
 F3=Exit         F5=Report       F10=Process/previous     F12=Cancel            &lt;br /&gt;
 F13=Layout      F16=Edit        F18=Files                F23=Long comment      &lt;br /&gt;
                                                                                &lt;br /&gt;
You can change how the display, or report, will look.  Here, I changed the heading from ‘VALUE’ to ‘Value’, and made the field lengths smaller.  As Value was the result of a calculation, its field length and number of decimals was based on the on hand and average cost fields.  It will never be that large, so it can be shortened for the report.  ASW defines the item number field as 35 characters long, but we only use 8.  Press enter.&lt;br /&gt;
&lt;br /&gt;
==Select Report Summary Functions==&lt;br /&gt;
&lt;br /&gt;
                        Select Report Summary Functions                         &lt;br /&gt;
                                                                                &lt;br /&gt;
 Type options, press Enter.                                                     &lt;br /&gt;
   1=Total   2=Average   3=Minimum   4=Maximum   5=Count                        &lt;br /&gt;
                                                                                &lt;br /&gt;
 ---Options---  Field           Text                                   Len  Dec &lt;br /&gt;
 _  _  _  _  _  T01.ITAGRP      Account Group                            4      &lt;br /&gt;
 _  _  _  _  _  T01.ITTYPE      Type                                     1      &lt;br /&gt;
 5  _  _  _  _  T01.ITPRDC      Item #                                   8      &lt;br /&gt;
 _  _  _  _  _  T01.ITDESC      Full Description                       100      &lt;br /&gt;
 _  _  _  _  _  T01.ITSIZE      Size                                    15      &lt;br /&gt;
 _  _  _  _  _  T01.ITRESP      Buyer                                   10&lt;br /&gt;
 _  _  _  _  _  T02.SRSROM      Warehouse number                         3&lt;br /&gt;
 _  _  _  _  _  T02.SRSTHQ      Quantity on hand                        15    3&lt;br /&gt;
 _  _  _  _  _  T02.SRAPCO      Average purchase cost                   17    4&lt;br /&gt;
 1  4  _  _  _  VALUE           T02.SRSTHQ * T02.SRAPCO                  9    2 &lt;br /&gt;
                                                                                &lt;br /&gt;
                                                                                &lt;br /&gt;
 F3=Exit       F5=Report       F10=Process/previous    F11=Display names only   &lt;br /&gt;
 F12=Cancel    F13=Layout      F18=Files               F23=Long comment         &lt;br /&gt;
                                                                                &lt;br /&gt;
I am saying that I want a count of how many items are on the list, the total value, and the highest individual total.&lt;br /&gt;
&lt;br /&gt;
==Define Report Breaks==&lt;br /&gt;
&lt;br /&gt;
                              Define Report Breaks                              &lt;br /&gt;
                                                                                &lt;br /&gt;
 Type break level (1-6) for up to 9 field names, press Enter.                   &lt;br /&gt;
   (Use as many fields as needed for each break level.)                         &lt;br /&gt;
                                                                                &lt;br /&gt;
 Break    Sort                                                                  &lt;br /&gt;
 Level    Prty  Field           Text                                   Len  Dec &lt;br /&gt;
   1        10  T01.ITAGRP      Account Group                            4      &lt;br /&gt;
   _            T01.ITTYPE      Type                                     1      &lt;br /&gt;
   _            T01.ITPRDC      Item #                                   8      &lt;br /&gt;
   _            T01.ITDESC      Full Description                       100      &lt;br /&gt;
   _            T01.ITSIZE      Size                                    15      &lt;br /&gt;
   _            T01.ITRESP      Buyer                                   10      &lt;br /&gt;
   _            T02.SRSROM      Warehouse number                         3      &lt;br /&gt;
   _            T02.SRSTHQ      Quantity on hand                        15    3 &lt;br /&gt;
   _            T02.SRAPCO      Average purchase cost                   17    4 &lt;br /&gt;
   _        20  VALUE           T02.SRSTHQ * T02.SRAPCO                  9    2 &lt;br /&gt;
                                                                                &lt;br /&gt;
 F3=Exit        F5=Report      F10=Process/previous    F11=Display names only   &lt;br /&gt;
 F12=Cancel     F13=Layout     F18=Files               F23=Long comment         &lt;br /&gt;
                                                                                &lt;br /&gt;
I want totals by item account group; as well as final totals.  Press enter until back to the list of options.&lt;br /&gt;
&lt;br /&gt;
==Special Output Type and Output Form==&lt;br /&gt;
&lt;br /&gt;
This is how to create a data file, which can be used as input to another Query, or to create a CSV file.&lt;br /&gt;
&lt;br /&gt;
                        Select Output Type and Output Form                       &lt;br /&gt;
                                                                                &lt;br /&gt;
 Type choices, press Enter.                                                     &lt;br /&gt;
                                                                                &lt;br /&gt;
   Output type  . . . . . . . . . . .   3     1=Display                         &lt;br /&gt;
                                              2=Printer                         &lt;br /&gt;
                                              3=Database file                   &lt;br /&gt;
                                                                                &lt;br /&gt;
   Form of output . . . . . . . . . .   1     1=Detail                          &lt;br /&gt;
                                              2=Summary only                    &lt;br /&gt;
                                                                                &lt;br /&gt;
   Line wrapping  . . . . . . . . . .   N     Y=Yes, N=No                       &lt;br /&gt;
     Wrapping width . . . . . . . . .         Blank, 1-378                      &lt;br /&gt;
     Record on one page . . . . . . .   N     Y=Yes, N=No                       &lt;br /&gt;
                                                                                &lt;br /&gt;
                                                                                &lt;br /&gt;
 F3=Exit           F5=Report           F10=Process/previous                     &lt;br /&gt;
 F12=Cancel        F13=Layout          F18=Files                                &lt;br /&gt;
     &lt;br /&gt;
‘Output type’ is 3 to create a file.  ‘Form of output’ is 1 to write all the detail records to the file, or 2 to only write the totals and subtotals (the defined report breaks).&lt;br /&gt;
                                                                           &lt;br /&gt;
                          Define Database File Output                           &lt;br /&gt;
                                                                                &lt;br /&gt;
 Type choices, press Enter.                                                     &lt;br /&gt;
   (The printed definition shows the output file record layout.)                &lt;br /&gt;
                                                                                &lt;br /&gt;
   File . . . . . . . . .   testfile       Name, F4 for list                    &lt;br /&gt;
     Library  . . . . . .     QTEMP        Name, F4 for list                    &lt;br /&gt;
   Member . . . . . . . .   *FILE          Name, *FIRST, *FILE, *ALL,           &lt;br /&gt;
                                           F4 for list                          &lt;br /&gt;
   Data in file . . . . .   2              1=New file, 2=Replace file           &lt;br /&gt;
                                           3=New member, 4=Replace member       &lt;br /&gt;
                                           5=Add to member                      &lt;br /&gt;
                                                                                &lt;br /&gt;
   For a new file:                                                              &lt;br /&gt;
     Authority  . . . . .   *LIBCRTAUT     *LIBCRTAUT, authorization list name, &lt;br /&gt;
                                           *CHANGE, *ALL, *EXCLUDE, *USE        &lt;br /&gt;
                                                                                &lt;br /&gt;
                                                                                &lt;br /&gt;
     Text . . . . . . . .   test file_________________________________________                                           &lt;br /&gt;
   Print definition . . .   N              Y=Yes, N=No                          &lt;br /&gt;
                                                                                &lt;br /&gt;
 F3=Exit          F4=Prompt        F5=Report          F10=Process/previous      &lt;br /&gt;
 F12=Cancel       F13=Layout       F18=Files                                    &lt;br /&gt;
  &lt;br /&gt;
Give the file a meaningful name and text.  If you want to keep this file for production, use library UP1480BFVA or UWDASWPRDD; for your own use, put it in your work library; if it is one time only, use QTEMP (which will be removed when you log off).  Be VERY careful not the name of a file that already exists; because you will replace it!  Press enter.&lt;br /&gt;
                                                                     &lt;br /&gt;
If you want to print a report – &lt;br /&gt;
&lt;br /&gt;
                        Select Output Type and Output Form                       &lt;br /&gt;
                                                                                &lt;br /&gt;
 Type choices, press Enter.                                                     &lt;br /&gt;
                                                                                &lt;br /&gt;
   Output type  . . . . . . . . . . .   2     1=Display                         &lt;br /&gt;
                                              2=Printer                         &lt;br /&gt;
                                              3=Database file                   &lt;br /&gt;
                                                                                &lt;br /&gt;
   Form of output . . . . . . . . . .   1     1=Detail                          &lt;br /&gt;
                                              2=Summary only                    &lt;br /&gt;
                                                                                &lt;br /&gt;
   Line wrapping  . . . . . . . . . .   N     Y=Yes, N=No                       &lt;br /&gt;
     Wrapping width . . . . . . . . .         Blank, 1-378                      &lt;br /&gt;
     Record on one page . . . . . . .   N     Y=Yes, N=No                       &lt;br /&gt;
                                                                                &lt;br /&gt;
                                                                                &lt;br /&gt;
 F3=Exit           F5=Report           F10=Process/previous                     &lt;br /&gt;
 F12=Cancel        F13=Layout          F18=Files                                &lt;br /&gt;
&lt;br /&gt;
                             Define Printer Output                              &lt;br /&gt;
                                                                                &lt;br /&gt;
 Type choices, press Enter.                                                     &lt;br /&gt;
                                                                                &lt;br /&gt;
   Printer  . . . . . . . . .   *PRINT       *PRINT, name                       &lt;br /&gt;
                                                                                &lt;br /&gt;
   Form size:                                                                   &lt;br /&gt;
     Length . . . . . . . . .                Blank, 1-255                       &lt;br /&gt;
     Width  . . . . . . . . .   132          Blank, 1-378                       &lt;br /&gt;
                                                                                &lt;br /&gt;
   Start line . . . . . . . .                Blank, 1-255                       &lt;br /&gt;
                                                                                &lt;br /&gt;
   End line . . . . . . . . .                Blank, 1-255                       &lt;br /&gt;
                                                                                &lt;br /&gt;
   Line spacing . . . . . . .   1            1, 2, 3                            &lt;br /&gt;
                                                                                &lt;br /&gt;
   Print definition . . . . .   N            Y=Yes, N=No                        &lt;br /&gt;
                                                                                &lt;br /&gt;
 F3=Exit           F5=Report           F10=Process/previous                     &lt;br /&gt;
 F12=Cancel        F13=Layout          F18=Files                                &lt;br /&gt;
                                                                                &lt;br /&gt;
The form width depends on how much data you are including (you can see by pressing F13 to show the layout).  If you can go as low as 80 the report will print in portrait, with a larger font.&lt;br /&gt;
&lt;br /&gt;
==Notes==&lt;br /&gt;
&lt;br /&gt;
To get the current date – &lt;br /&gt;
&lt;br /&gt;
 WORK	current(date)&lt;br /&gt;
&lt;br /&gt;
To get last month’s date (not exactly, as months can be from 28 to 31 days; so this only works up to the 29th) – &lt;br /&gt;
&lt;br /&gt;
 WORK	date(days(current(date))-28)&lt;br /&gt;
&lt;br /&gt;
To build from and to dates to search for records dated the previous month (the ‘TO’ value won’t always be correct, but it will work) – &lt;br /&gt;
&lt;br /&gt;
 FROM		year(work)* 10000 + month(work) * 100 + 01              &lt;br /&gt;
 TO		year(work)* 10000 + month(work) * 100 + 31&lt;/div&gt;</summary>
		<author><name>Sheilav</name></author>
	</entry>
</feed>