SELECT PKEY, MIN(CHARCOL), MAX(DATE) FROM TABLE GROUP BY PKEY
can same be done through sort? Like calculating MIN and MAX on CHAR columns in SORT? I know sections and trailer3 can find min, max, count but only on numeric columns.
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
If MIN and MAX can only be numeric, make them numeric. CH takes account of all 256 bit-values per byte. BI takes account of all 256 bit-values per byte. Define your "CHAR" fields as BI.
This is working fine, except the last BUILD statement which is not converting as per ALTSEQ. Basically I want the COUNT values to be encoded in ASCII format instead of EBCDIC.
OUTFIL FILES=OUT,NODETAIL,REMOVECC,
SECTIONS=(01,03,
04,06,
10,03,
13,04,
17,10,
27,10,
117,01,
TRAILER3=(001:001,03,X,
005:004,06,X,
012:010,03,X,
016:013,04,X,
021:017,10,X,
032:027,10,
042:037,01,X,
044:038,10,X,
055:COUNT=(M11,LENGTH=10),
066:064,19,X,
086:083,10,X,
097:109,08,X,
106:117,01)),
BUILD=(1,54,55,10,TRAN=ALTSEQ,65,42)
WER276B SYSDIAG= 11403908, 13520256, 13520256, 2807635
WER164B 65,540K BYTES OF VIRTUAL STORAGE AVAILABLE, MAX REQUESTED,
WER164B 156K BYTES RESERVE REQUESTED, 65,512K BYTES USED
WER146B 24K BYTES OF EMERGENCY SPACE ALLOCATED
WER108I SORTIN : RECFM=FB ; LRECL= 118; BLKSIZE= 27966
WER073I SORTIN : DSNAME=XXXXXX.XXXXXX.XXXXX.SYSREC00
WER110I SORTOUT : RECFM=FB ; LRECL= 106; BLKSIZE= 27984
WER074I SORTOUT : DSNAME=XXXXXX.XXXXXX.XXXXX.SYSREC00.OUT1
WER410B 63M BYTES OF VIRTUAL STORAGE AVAILABLE ABOVE THE 16MEG LINE,
WER410B 0 BYTES RESERVE REQUESTED, 63M BYTES USED
WER036B G=17538,B=451
WER045C END SORT PHASE
WER055I INSERT 0, DELETE 16383
WER418I DATASPACE(S) AND/OR ZSPACE USED
WER405I SORTOUT : DATA RECORDS OUT 0; TOTAL RECORDS OUT 1
WER493I ZIIP PROCESSOR USED
WER211B SYNCSMF CALLED BY SYNCSORT; RC=0000
WER416B SORTIN : EXCP'S=1,UNIT=3390,DEV=C226,CHP=(7071727374755455,1),VOL=TB
WER416B OUTFIL WAS USED FOR SORTOUT
WER246I FILESIZE 43,070 BYTES
WER054I RCD IN 16748, OUT 365
WER072I NOEQUALS, BALANCE IN EFFECT
WER169I RELEASE 1.4 BATCH 0525 TPF LEVEL 1.0
WER052I END SYNCSORT - XXXXXXXX,STEP010,,DIAG=E300,7092,CA35,6C57,BBCA,4C8B,02
We can see the value 365 is readable, but i want it to get encoded in ascii
Code:
Command ===> Scroll ===> CSR
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
----+----F----+----F----+----F----+----F----+----F----+----F----+----F----+----F
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
------------------------------------------------------------------------------
********************************* Top of Data **********************************
------------------------------------------------------------------------------
... ...... ... .... .......... ........... .......... 0000000365 ...............
333433333343334333343333233233400000000003433332332334FFFFFFFFFF4333333333332222
141004410301090201402014D01D1500000000000F02015D02D22000000003650141108013130000
------------------------------------------------------------------------------
******************************** Bottom of Data ********************************
As this file will be used to load a table and everything has be in ASCII to use this card
Code:
LOAD DATA
LOG NO ENFORCE NO
UNICODE CCSID(0367, 1208, 1200)
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
SECTIONS and TRAILER3 are reporting features. You're not going to get anything there converted to ASCII. Data, yes. Reporting output, no.
You have a SORT already. Have a look at doing what you want with SUM (or variation). Consult the documentation. There are significant differences between DFSORT and SyncSORT in SUM and friends.
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
It is not only the COUNT you are a problem with, look at the blanks as well.
Everything on TRAILER3 which is not directly sourced from your ASCII data will be in EBCDIC, and you will have no, none, nada, zero, zip chance of changing it in the same step once produced by TRAILER3.
If you are desperate to have a count in ASCII, do as I said. Which is to use SUM. Add a field to each record which is the size you want with a value of one. SUM (or similar) on that field. Do all your other formatting of the data (the spaces, anything else needed).
Using TRAILER3 you get the "last" record of duplicate. With SyncSORT you can arrange for that in the summing I think.