IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Using SORT on Unicode data


IBM Mainframe Forums -> SYNCSORT
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
gylbharat

Active Member


Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

PostPosted: Thu Feb 26, 2015 5:40 pm
Reply with quote

Hi Bill,

One more question -

Like suppose in SQL i have

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.

How can we calculate MIN/MAX on char columns?
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Feb 26, 2015 6:16 pm
Reply with quote

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.
Back to top
View user's profile Send private message
gylbharat

Active Member


Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

PostPosted: Thu Feb 26, 2015 6:55 pm
Reply with quote

Hi Bill,

I tried this by using BI but getting numeric field error:

Code:

   ALTSEQ CODE=(F030,F131,F232,F333,F434,F535,F636,F737,F838,F939)             
                                                                               
   INCLUDE COND=(17,10,CH,GT,X'313930302D30312D3031',AND,  * 1900-01-01         
                 118,1,BI,LT,X'41')                        * A                 
                                                                               
   SORT FIELDS=(01,03,CH,A,                       
                04,06,CH,A,                     
                10,03,CH,A,                     
                13,04,CH,A,                     
                17,10,CH,A,                     
                27,10,CH,A,                     
                38,10,CH,A,                     
                64,19,CH,D,                     
                83,10,CH,D,                     
               109,08,CH,D,                     
               117,01,CH,A)                     
                                                 
   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:MIN=(064,19,BI),X,   
                           *           
              086:083,10,X,             
              097:109,08,X,             
              106:117,01)),             
   BUILD=(1,54,55,10,TRAN=ALTSEQ,65,42,5X)                                     
WER271A  OUTFIL STATEMENT  : NUMERIC FIELD ERROR                               
WER211B  SYNCSMF  CALLED BY SYNCSORT; RC=0000                                 


Is it something I am missing here?
Back to top
View user's profile Send private message
gylbharat

Active Member


Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

PostPosted: Thu Feb 26, 2015 7:06 pm
Reply with quote

Also, another question - I have specified =
Code:
BUILD=
statement to do TRAN=ALTSEQ of the count field, but it is not working. Is there a way to convert
Code:
055:COUNT=(M11,LENGTH=10)
into this ALTSEQ
Code:
 ALTSEQ CODE=(F030,F131,F232,F333,F434,F535,F636,F737,F838,F939)   

In same sort step?
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Feb 26, 2015 7:11 pm
Reply with quote

OK, so a short-coming in the approach. If you use BI, there is a limit to the length you can use, and 19 busts it.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Feb 26, 2015 7:14 pm
Reply with quote

I don't understand the second question. COUNT= just gives you a count. That shouldn't have any relationship to ALTSEQ.

Can you post what you are actually trying, and what you want to do with the COUNT?
Back to top
View user's profile Send private message
gylbharat

Active Member


Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

PostPosted: Thu Feb 26, 2015 7:22 pm
Reply with quote

Hi Bill,

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.


Code:
 ALTSEQ CODE=(F030,F131,F232,F333,F434,F535,F636,F737,F838,F939)             
                                                                             
 INCLUDE COND=(17,10,CH,GT,X'313930302D30312D3031',AND,  * 1900-01-01         
               118,1,BI,LT,X'41')                        * A                 
                                                                             
 SORT FIELDS=(01,03,CH,A,                       
              04,06,CH,A,                     
              10,03,CH,A,                     
              13,04,CH,A,                     
              17,10,CH,A,                     
              27,10,CH,A,                     
              38,10,CH,A,                     
              64,19,CH,D,                     
              83,10,CH,D,                     
             109,08,CH,D,                     
             117,01,CH,A)                     
                                                                             
 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)     
                                     
INTO TABLE XXXX.YYYYYYY         
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Feb 26, 2015 8:47 pm
Reply with quote

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.
Back to top
View user's profile Send private message
gylbharat

Active Member


Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

PostPosted: Thu Feb 26, 2015 9:30 pm
Reply with quote

Hi Bill,

I am sorry, i did not get you. You mean we cannot convert the COUNT output to ASCII using build/outrec statement in outfil?
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Feb 26, 2015 9:54 pm
Reply with quote

The BUILD on OUTFIL only affects data records, not reporting lines.

You cannot change reporting lines other than is described for the lines.

So no, you cannot change the reporting lines produced in OUTFIL to ASCII (or anything else) in that same OUTFIL or any other OUTFIL in that step.

I'm confused, I thought you were going from ASCII/something-else to EBCDIC. Now you seem to be going back again?
Back to top
View user's profile Send private message
gylbharat

Active Member


Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

PostPosted: Fri Feb 27, 2015 1:38 pm
Reply with quote

Hi Bill,

Now, with the above sort card, i was able to directly process ascii data. But only think of concern was COUNT field was in EBCDIC.

I have to load this file to a table so was thinking if there is any way to convert the count field to ASCII also in the same step.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Feb 27, 2015 2:39 pm
Reply with quote

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.

Then, in OUTREC or OUTFIL you can do the TRAN=.
Back to top
View user's profile Send private message
gylbharat

Active Member


Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

PostPosted: Fri Feb 27, 2015 4:11 pm
Reply with quote

Thanks Bill

I will try to look into options as you suggested.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> SYNCSORT Goto page 1, 2  Next

 


Similar Topics
Topic Forum Replies
No new posts Store the data for fixed length COBOL Programming 1
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Data set Rec-Cnt and Byte-Cnt Testing & Performance 2
No new posts JCL sort card - get first day and las... JCL & VSAM 9
Search our Forums:

Back to Top