Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Can presence of a field be checked using SORT?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
balimanja

New User


Joined: 14 Aug 2007
Posts: 39
Location: Bangalore

PostPosted: Mon Sep 10, 2007 2:00 pm    Post subject: Can presence of a field be checked using SORT?
Reply with quote

Hi ALL,

The problem I am facing now is as follows:

There are two fields/cols in a file. The requirement demands that if the second field is present then insert a hyphen between the two fields, else output the number as it is.

E.g.:
Code:

FIELD1  FIELD2  REQ.OUTPUT
100     A       100-A
1234    TER     1234-TER
6543    PUT     6543-PUT
3984            3984



Here Field1 is 8 char in length and Field2 is 4 char in length.

I believe IFTHEN needs to be used but I am new to SORT/SYNCTOOL.

THANK YOU ALL for your time on this.
Back to top
View user's profile Send private message

ashokm

New User


Joined: 28 Feb 2006
Posts: 11
Location: Chennai,India

PostPosted: Mon Sep 10, 2007 2:55 pm    Post subject:
Reply with quote

Hi Balimanja,


Here the JCL :

//SPLIT1R EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=XXXXX.ICE.INPUT,DISP=SHR
//SORTOUT DD DSN=XXXXX..ICE.OUTPUT,DISP=SHR
//SYSIN DD *
OPTION COPY
INREC OVERLAY=(1,12,SQZ=(SHIFT=LEFT,PREBLANK=C' '))
/*

Ashok M
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1439
Location: Bangalore,India

PostPosted: Mon Sep 10, 2007 2:59 pm    Post subject:
Reply with quote

ashokm,

Quote:
I believe IFTHEN needs to be used but I am new to SORT/SYNCTOOL.


Your solution uses ICEMAN (DFSORT product). But the original post says balimanja needs a solution using syncsort.
Back to top
View user's profile Send private message
balimanja

New User


Joined: 14 Aug 2007
Posts: 39
Location: Bangalore

PostPosted: Mon Sep 10, 2007 3:53 pm    Post subject:
Reply with quote

Thanks Murali & Ashok

Ashok,

I tried your code but I am getting a syntax error.

Code:
OPTION COPY
INREC OVERLAY=(1,12,SQZ=(SHIFT=LEFT,PREBLANK=C' '))
                    *


Need help,

Thanks again
Back to top
View user's profile Send private message
shankar.v

Active User


Joined: 25 Jun 2007
Posts: 196
Location: Bangalore

PostPosted: Mon Sep 10, 2007 4:14 pm    Post subject:
Reply with quote

balimanja,

If your shop contains a SYNCSORT product, try with the following code.
The following code works fine for non-spaces values of field-1
Code:
// EXEC PGM=SORT                                                     
//SYSOUT DD SYSOUT=*                                                   
//SORTIN DD *                                                           
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
100     A                                                               
1234    TER                                                             
6543    PUT                                                             
3984                                                                   
/*                                                                     
//SORTOUT DD SYSOUT=*                                                   
//SYSIN DD *                                                           
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
 OPTION COPY                                                           
 INREC IFTHEN=(WHEN=(9,4,CH,EQ,C' '),BUILD=(1,8)),                     
       IFTHEN=(WHEN=(8,1,CH,NE,C' '),BUILD=(1,8,C'-',9,4)),             
       IFTHEN=(WHEN=(7,1,CH,NE,C' '),BUILD=(1,7,C'-',9,4)),             
       IFTHEN=(WHEN=(6,1,CH,NE,C' '),BUILD=(1,6,C'-',9,4)),             
       IFTHEN=(WHEN=(5,1,CH,NE,C' '),BUILD=(1,5,C'-',9,4)),
       IFTHEN=(WHEN=(4,1,CH,NE,C' '),BUILD=(1,4,C'-',9,4)),
       IFTHEN=(WHEN=(3,1,CH,NE,C' '),BUILD=(1,3,C'-',9,4)),
       IFTHEN=(WHEN=(2,1,CH,NE,C' '),BUILD=(1,2,C'-',9,4)),
       IFTHEN=(WHEN=(1,1,CH,NE,C' '),BUILD=(1,1,C'-',9,4))
 OUTFIL IFOUTLEN=80

Output:
Code:
100-A   
1234-TER
6543-PUT
3984


If your post relates to a SYNCSORT, please post under JCL forum. This area is for DFSORT/ICETOOL and not for SYNCSORT.
Back to top
View user's profile Send private message
ashokm

New User


Joined: 28 Feb 2006
Posts: 11
Location: Chennai,India

PostPosted: Mon Sep 10, 2007 4:15 pm    Post subject:
Reply with quote

Hi,

That JCL removes all the spaces.This is one what you expect .

//SPLIT1R EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=XXXXX.ICE.INPUT,DISP=SHR
//SORTOUT DD DSN=XXXX.ICE.OUTPUT,DISP=SHR
//SYSIN DD *
OPTION COPY
INREC BUILD=(1,12,SQZ=(SHIFT=LEFT,MID=C'-'))
/*

Ashok M
Back to top
View user's profile Send private message
stodolas

Active Member


Joined: 13 Jun 2007
Posts: 632
Location: Wisconsin

PostPosted: Mon Sep 10, 2007 5:27 pm    Post subject:
Reply with quote

murmohk1: When execute ICEMAN in my shop, it is an alias for SYNCTOOL.
Back to top
View user's profile Send private message
balimanja

New User


Joined: 14 Aug 2007
Posts: 39
Location: Bangalore

PostPosted: Mon Sep 10, 2007 5:49 pm    Post subject:
Reply with quote

Shankar,

The code you posted, is it complete? I am getting error. Please let me know.

Thank you
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2150
Location: At my coffee table

PostPosted: Mon Sep 10, 2007 5:57 pm    Post subject:
Reply with quote

balimanja wrote:
The code you posted, is it complete? I am getting error. Please let me know.
It would help greatly if you posted the sysout with the error. Very few here a that good at mind reading.... icon_wink.gif
Back to top
View user's profile Send private message
shankar.v

Active User


Joined: 25 Jun 2007
Posts: 196
Location: Bangalore

PostPosted: Mon Sep 10, 2007 6:37 pm    Post subject:
Reply with quote

balimanja

The code i posted was ran successfully with syncsort for z/os 1.2.3
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1288
Location: Chennai, India

PostPosted: Mon Sep 10, 2007 6:58 pm    Post subject: Reply to: Can presence of a field be checked using SORT?
Reply with quote

There is no /* after the instream data. Else, Please post the error info.
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2150
Location: At my coffee table

PostPosted: Mon Sep 10, 2007 7:21 pm    Post subject: Re: Reply to: Can presence of a field be checked using SORT?
Reply with quote

Aaru wrote:
There is no /* after the instream data.
Huh? icon_confused.gif
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1288
Location: Chennai, India

PostPosted: Mon Sep 10, 2007 7:41 pm    Post subject: Reply to: Can presence of a field be checked using SORT?
Reply with quote

CICS Guy,

That was a Typo icon_sad.gif
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


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

PostPosted: Mon Sep 10, 2007 9:24 pm    Post subject:
Reply with quote

Quote:
Ashok,

I tried your code but I am getting a syntax error.


SQZ is a DFSORT function. It is NOT supported by Syncsort.
Back to top
View user's profile Send private message
balimanja

New User


Joined: 14 Aug 2007
Posts: 39
Location: Bangalore

PostPosted: Tue Sep 11, 2007 11:03 am    Post subject:
Reply with quote

Shankar/Frank,

Isn't there any alternative?
Back to top
View user's profile Send private message
shankar.v

Active User


Joined: 25 Jun 2007
Posts: 196
Location: Bangalore

PostPosted: Tue Sep 11, 2007 11:14 am    Post subject:
Reply with quote

balimanja,
Quote:
The code you posted, is it complete? I am getting error. Please let me know.

The code i posted was ran successfully with syncsort for z/os 1.2.3.
If you face any problem with that code, please post the full sysout messages that starts from SYSIN.
Quote:
Isn't there any alternative?

The before posted frank words are true.
If i find anything which fulfill your requirements, i will come up with the code.
Back to top
View user's profile Send private message
balimanja

New User


Joined: 14 Aug 2007
Posts: 39
Location: Bangalore

PostPosted: Tue Sep 11, 2007 11:28 am    Post subject:
Reply with quote

Thank You Shankar,

Here is what I get:
Code:
SYSIN    :                                                                 
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
                                                                       *
 OPTION COPY                                                           
 INREC IFTHEN=(WHEN=(9,4,CH,EQ,C' '),BUILD=(1,8)),                     
       IFTHEN=(WHEN=(8,1,CH,NE,C' '),BUILD=(1,8,C'-',9,4)),             
       IFTHEN=(WHEN=(7,1,CH,NE,C' '),BUILD=(1,7,C'-',9,4)),             
       IFTHEN=(WHEN=(6,1,CH,NE,C' '),BUILD=(1,6,C'-',9,4)),             
       IFTHEN=(WHEN=(5,1,CH,NE,C' '),BUILD=(1,5,C'-',9,4)),             
       IFTHEN=(WHEN=(4,1,CH,NE,C' '),BUILD=(1,4,C'-',9,4)),             
       IFTHEN=(WHEN=(3,1,CH,NE,C' '),BUILD=(1,3,C'-',9,4)),             
       IFTHEN=(WHEN=(2,1,CH,NE,C' '),BUILD=(1,2,C'-',9,4)),             
       IFTHEN=(WHEN=(1,1,CH,NE,C' '),BUILD=(1,1,C'-',9,4))             
 OUTFIL IFOUTLEN=80                                                     
     SORT FIELDS=COPY                                                   
WER275A  NO KEYWORDS FOUND ON CONTROL STATEMENT                         
WER211B  SYNCSMF  CALLED BY SYNCSORT; RC=0000                           
WER449I  SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE                           


By the way, why is there an asterisk present in the end of the column margin??
Back to top
View user's profile Send private message
balimanja

New User


Joined: 14 Aug 2007
Posts: 39
Location: Bangalore

PostPosted: Tue Sep 11, 2007 11:29 am    Post subject:
Reply with quote

Disregard the SORT FIELDS=COPY statement it was added by mistake.
Back to top
View user's profile Send private message
balimanja

New User


Joined: 14 Aug 2007
Posts: 39
Location: Bangalore

PostPosted: Tue Sep 11, 2007 12:01 pm    Post subject:
Reply with quote

Shankar,

It is working great. The problem was with the column margin present after the SYSIN DD *.


Thank You.

and Thanks to Ashok, Frank and to all who replied.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Difference in SORT & ICETOOL Mohan Kothakota DFSORT/ICETOOL 5 Fri Sep 22, 2017 4:56 pm
No new posts OC4 in SORT Mohan Kothakota DFSORT/ICETOOL 2 Tue Sep 12, 2017 6:30 pm
No new posts Remove leading spaces from numeric field rexx77 SYNCSORT 6 Wed Sep 06, 2017 2:15 am
No new posts JES2 job size field matching Windows ... SRICOBSAS All Other Mainframe Topics 4 Tue Sep 05, 2017 5:49 pm
No new posts SORT Trailer Count - LRECL Output co... amorante DFSORT/ICETOOL 5 Tue Aug 29, 2017 8:57 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us