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

Syncsort - ALPHABETIC check in SORT


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
nareshdacha

New User


Joined: 12 Jan 2010
Posts: 66
Location: US

PostPosted: Thu Jul 21, 2011 3:34 am
Reply with quote

I have the input file as follows:
Input file length is 80 and RECFM is FB. This file contains only one field which is of X(18). Now i need to extract only ALPHABETIC values to the output file using SORT CARD.
In COBOL, i can do that using ' IS ALPHABETIC' am not supposed to use COBOL program for this.

In forum, i found how to check NUMERIC but didn't find for ALPHABETIC.

Input file:
Code:

ABCD1234
PQRS
PQRS8989
BNBUI
EWEWEW
9090909


Output should be:
Code:

PQRS
BNBUI
EWEWEW

Can anyone suggest me on this ????
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Thu Jul 21, 2011 4:22 am
Reply with quote

If you mean that you want to only include a record if EVERY character in that record is uppercase A-Z or blank, you can use a DFSORT job like the following:

Code:

//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SYMNAMES DD *
ALPHA,' ABCDEFGHIJKLMNOPQRSTUVWXYZ'
//SORTIN DD *
ABCD1234
PQRS
PQRS8989
BNBUI
EWEWEW
9090909
//SORTOUT DD SYSOUT=*
//SYSIN DD *
  OPTION COPY
  OMIT FORMAT=SS,                       
       COND=(1,1,NE,ALPHA,OR,           
             2,1,NE,ALPHA,OR,           
             3,1,NE,ALPHA,OR,           
             4,1,NE,ALPHA,OR,           
             5,1,NE,ALPHA,OR,           
             6,1,NE,ALPHA,OR,           
             7,1,NE,ALPHA,OR,           
             8,1,NE,ALPHA,OR,           
             9,1,NE,ALPHA,OR,           
            10,1,NE,ALPHA,OR,           
            11,1,NE,ALPHA,OR,           
            12,1,NE,ALPHA,OR,           
            13,1,NE,ALPHA,OR,           
            14,1,NE,ALPHA,OR,           
            15,1,NE,ALPHA,OR,           
            16,1,NE,ALPHA,OR,           
            17,1,NE,ALPHA,OR,           
            18,1,NE,ALPHA)             
/*
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Thu Jul 21, 2011 4:53 am
Reply with quote

Hi,

do spaces qualify as ALPHABETIC ?

Does this qualify for output
Code:
 PQRS



Gerry
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 Jul 21, 2011 5:01 am
Reply with quote

From the sample data, yes, as far as it goes - first input line is blank, as is first output. Up to TS, I suppose, to come back if he doesn't want leading spaces followed by letters.
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Thu Jul 21, 2011 5:10 am
Reply with quote

Hi Bill,

I missed the first input line icon_redface.gif


Gerry
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Thu Jul 21, 2011 5:12 am
Reply with quote

I assumed leading, trailing and embedded spaces would be considered alphabetic. If that's not the case, then the OP will have to define what he wants more precisely.
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 Jul 21, 2011 5:21 am
Reply with quote

Hi Gerry,

Very easily done, the blank line can become invisible when pondering the leading spaces. When I set out test data, I put "this line intentionally left blank". Personally I'd suspect that the TS thinks leading blanks are not possibile - however, data had to come from somewhere, usually leads back to data-entry at some point and he should want to know whether to include or not, which is where your question helps anyway.
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Thu Jul 21, 2011 6:41 am
Reply with quote

Hi Bill,

from OP
Quote:
In COBOL, i can do that using ' IS ALPHABETIC' am not supposed to use COBOL program for this.


I'm no Cobol programmer, so I googled and found this
Quote:
In OS/VS COBOL, only uppercase letters and the space character were considered to be ALPHABETIC.
In Enterprise COBOL, uppercase letters, lowercase letters, and the space character are considered to be ALPHABETIC.

If your OS/VS COBOL program uses the ALPHABETIC class test, and the data tested consists of mixed uppercase and lowercase letters, there can be differences in execution results. In such cases, you can ensure identical results by substituting the Enterprise COBOL ALPHABETIC-UPPER class test for the OS/VS COBOL ALPHABETIC test.



So it seems spaces are acceptable.

Gerry
Back to top
View user's profile Send private message
nareshdacha

New User


Joined: 12 Jan 2010
Posts: 66
Location: US

PostPosted: Thu Jul 21, 2011 8:48 am
Reply with quote

Thank you all for your suggestions...
When i try to execute the code no records got selected..
Sorry for the confusion...SPACES are not required for the output.

My job log details:

Code:

WER164B  8,884K BYTES OF VIRTUAL STORAGE AVAILABLE, MAX REQUESTED,
WER164B     0 BYTES RESERVE REQUESTED, 1,412K BYTES USED
WER146B  12K BYTES OF EMERGENCY SPACE ALLOCATED
WER108I  SORTIN   : RECFM=FB   ; LRECL=    80; BLKSIZE=    80
WER110I  SORTOUT  : RECFM=FB   ; LRECL=    80; BLKSIZE= 27920
WER410B  7,856K BYTES OF VIRTUAL STORAGE AVAILABLE ABOVE THE 16MEG LIN
WER410B     0 BYTES RESERVE REQUESTED, 1,284K BYTES USED
WER055I  INSERT          0, DELETE          5
WER449I  SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE
WER416B  BSAM WAS USED FOR SORTIN
WER416B  SORTOUT  : EXCP'S=0,UNIT=3390,DEV=C78A,CHP=(B0B1B2B3B4B5B6,1)
WER054I  RCD IN          5, OUT          0
WER169I  RELEASE 1.3 BATCH 0492 TPF LEVEL 2.1
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Thu Jul 21, 2011 8:57 am
Reply with quote

Hi,

please show the entire job you have run.

Also the number of records read does not match your original input of 7 records.


Gerry
Back to top
View user's profile Send private message
nareshdacha

New User


Joined: 12 Jan 2010
Posts: 66
Location: US

PostPosted: Thu Jul 21, 2011 9:02 am
Reply with quote

Here is my job...

Code:

//STEP1    EXEC  PGM=SORT
//SYMNAMES DD *
ALPHA,'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
//SORTIN   DD  *
ABCD1234
PQRS
PQRS8989
EWEWEW
9090909
//SORTOUT  DD  DSN=XXX.YYYY,DISP=(NEW,CATLG),
//             DCB=(RECFM=FB,LRECL=80),SPACE=(CYL,(5,5))
//SYSPRINT DD  SYSOUT=*
//SYSOUT   DD  SYSOUT=*
//SYSIN    DD  *
OPTION COPY
OMIT FORMAT=SS,
COND=(1,1,NE,ALPHA,OR,
      2,1,NE,ALPHA,OR,
      3,1,NE,ALPHA,OR,
      4,1,NE,ALPHA,OR,
      5,1,NE,ALPHA,OR,
      6,1,NE,ALPHA,OR,
      7,1,NE,ALPHA,OR,
      8,1,NE,ALPHA,OR,
      9,1,NE,ALPHA,OR,
     10,1,NE,ALPHA,OR,
     11,1,NE,ALPHA,OR,
     12,1,NE,ALPHA,OR,
     13,1,NE,ALPHA,OR,
     14,1,NE,ALPHA,OR,
     15,1,NE,ALPHA,OR,
     16,1,NE,ALPHA,OR,
     17,1,NE,ALPHA,OR,
     18,1,NE,ALPHA)
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Thu Jul 21, 2011 9:11 am
Reply with quote

Hi,

you have dropped the space before ABC
Code:
ALPHA,' ABCDEFGHIJKLMNOPQRSTUVWXYZ'


Gerry
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu Jul 21, 2011 9:45 am
Reply with quote

Hi Gerry,

Quote:
you have dropped the space before ABC


Quote:
Sorry for the confusion...SPACES are not required for the output.


I may be missing somethng, but it appears that spaces are NOT to be selected. . .

All of the compares go thru position 18 and none of the data is that long. . .?

I don't have Syncsort documentation on this system, so i can't read up tonight. . .
Back to top
View user's profile Send private message
nareshdacha

New User


Joined: 12 Jan 2010
Posts: 66
Location: US

PostPosted: Thu Jul 21, 2011 9:53 am
Reply with quote

Thanks for the correction...
Thank you all for your time and suggestion..
Back to top
View user's profile Send private message
nareshdacha

New User


Joined: 12 Jan 2010
Posts: 66
Location: US

PostPosted: Thu Jul 21, 2011 9:55 am
Reply with quote

Am filtering SPACES records in other step....
Can we do that in that step itself ?..
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Thu Jul 21, 2011 10:56 am
Reply with quote

Hi Dick,

Quote:
I may be missing somethng, but it appears that spaces are NOT to be selected. . .



All records have a space between 1-18, if the field that has a space in it is not to be selected then none of the records pass the test.

I really think the op means a combination of spaces and A-Z is ok.

A field with all spaces is to be dropped.

Naresh, is this what you mean ?

Gerry
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu Jul 21, 2011 10:56 am
Reply with quote

Hello,

Possibly - once we understand exactly what you want in total.

If you post the original input data including all cases and then show how you want each record handled (completely explain the rules - for example should a bunch of trailing spaces be ignored or should these cause records to be omitted?), someone will probably have a suggestion.

Please use the "Code" tag to preserve alignment and improve readability.
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Thu Jul 21, 2011 10:59 am
Reply with quote

The TS is using SYNCSORT not DFSORT.
Frank Yaeger's sample is DFSORT.
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Thu Jul 21, 2011 11:02 am
Reply with quote

Hi Peter,

it works with SYNCSORT as well.


Gerry
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Thu Jul 21, 2011 11:25 am
Reply with quote

Hi Gerry,

i thought the TS had a problem (getting no output), caused by using SS instead of DS.
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 Jul 22, 2011 4:43 am
Reply with quote

Borrowing Frank's code

Code:
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SYMNAMES DD *
ALPHA,' ABCDEFGHIJKLMNOPQRSTUVWXYZ'
WHOLERECORD,1,18,CH
//SORTIN DD *
ABCD1234
PQRS
PQRS8989
BNBUI
EWEWEW
9090909
//SORTOUT DD SYSOUT=*
//SYSIN DD *
  OPTION COPY
  OMIT FORMAT=SS,                       
       COND=(1,1,NE,ALPHA,OR,           
             2,1,NE,ALPHA,OR,           
             3,1,NE,ALPHA,OR,           
             4,1,NE,ALPHA,OR,           
             5,1,NE,ALPHA,OR,           
             6,1,NE,ALPHA,OR,           
             7,1,NE,ALPHA,OR,           
             8,1,NE,ALPHA,OR,           
             9,1,NE,ALPHA,OR,           
            10,1,NE,ALPHA,OR,           
            11,1,NE,ALPHA,OR,           
            12,1,NE,ALPHA,OR,           
            13,1,NE,ALPHA,OR,           
            14,1,NE,ALPHA,OR,           
            15,1,NE,ALPHA,OR,           
            16,1,NE,ALPHA,OR,           
            17,1,NE,ALPHA,OR,           
            18,1,NE,ALPHA,OR,
            WHOLERECORD,EQ,C'                  ')             
/*


Untested. I don't have a syncsort manual, but maybe it just needs C' ' or something else to get all the spaces at once.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Fri Jul 22, 2011 10:52 am
Reply with quote

Mr Woodger,

my respect. very good. with dfsort, the change works.
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 Jul 22, 2011 11:51 am
Reply with quote

Thanks, I hope (know) you didn't test it with my data above :-)

Code:

This line intentionally left blank
ABCD1234
PQRS
PQRS8989
BNBUI
EWEWEW
9090909
 QYOUWANTTOKEEP
    THEQUICKREDFOX
     JUMPEDOVERTHE
           LAZYDOG
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 7
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts SCOPE PENDING option -check data DB2 2
No new posts Check data with Exception Table DB2 0
Search our Forums:

Back to Top