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

Extract only numbers from input file records


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

New User


Joined: 20 Apr 2007
Posts: 5
Location: Hyderabad

PostPosted: Thu Sep 27, 2007 4:47 pm
Reply with quote

My input file consists of records

abcd1
abcd2
abcd3
abcd4
--------
-------
-------

abcd15

and i need my outputfile only


1
2
3
4




15


so plz suggest me in sort technique

i..e

//sysin dd *
sort records = (
Back to top
View user's profile Send private message
murmohk1

Senior Member


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

PostPosted: Thu Sep 27, 2007 7:27 pm
Reply with quote

nag,

Code:
//SYSIN DD *                                                 
  SORT FIELDS=COPY                                           
  OUTREC BUILD=(1,30,SQZ=(SHIFT=LEFT,                       
   PREBLANK=C'ABCDEFGHIJKLMNOPQRSTUVWXYZ'))                           
/*         


IP LRECL assumed is 30. According to your file LRECL, change in the PREBLANK statement.
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 Sep 27, 2007 8:32 pm
Reply with quote

Is this an interview question or a class project?
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 Sep 27, 2007 9:40 pm
Reply with quote

Murali,

That won't work. You have more than the maximum of 10 characters allowed for one PREBLANK string, and you're using uppercase characters instead of lowercase characters.

This DFSORT job will work for the given example:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (FB/80)
//SORTOUT DD DSN=...  output file (FB/80)
//SYSIN DD *
  SORT FIELDS=COPY
  OUTREC OVERLAY=(1:1,80,SQZ=(SHIFT=LEFT,PREBLANK=C'abcdefghij'),
   1:1,80,SQZ=(SHIFT=LEFT,PREBLANK=C'klmnopqrst'),
   1:1,80,SQZ=(SHIFT=LEFT,PREBLANK=C'uvwxyz'))
/*
Back to top
View user's profile Send private message
murmohk1

Senior Member


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

PostPosted: Fri Sep 28, 2007 7:13 am
Reply with quote

Frank,

Quote:
That won't work. You have more than the maximum of 10 characters allowed

Thanks for notifying me. I have not implemented this on MF before post. Taking your sort card in one of the day before yesterday's post, I had posted this.

Once again, Thanks.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Fri Sep 28, 2007 2:17 pm
Reply with quote

Hi,

I hope, you already have the best solution by Frank, still for the situation in question, one alternate solution can be used, shown below:

Input:
Code:
000001 ABCD1
000002 ABCD2
000003 ABCD3
000004 ABCD4
000005 ABCD5
000006 ABCD6
000007 ABCD7
000008 ABCD8

Use block command as shwon below
((4
.
.
((
& press enter.
Code:
((4001 ABCD1
000002 ABCD2
000003 ABCD3
000004 ABCD4
000005 ABCD5
000006 ABCD6
000007 ABCD7
((0008 ABCD8


Output:
Code:
000001 1
000002 2
000003 3
000004 4
000005 5
000006 6
000007 7
000008 8


Hope this helps.
Back to top
View user's profile Send private message
ajayvamsi

New User


Joined: 21 Jul 2005
Posts: 56
Location: Hyderabad

PostPosted: Fri Sep 28, 2007 2:25 pm
Reply with quote

Code:

//SYSIN DD *                                                 
  SORT FIELDS=COPY                                           
  OUTREC BUILD=(1,30,SQZ=(SHIFT=LEFT,                       
   PREBLANK=C'ABCDEFGHIJKLMNOPQRSTUVWXYZ'))                           
/*   


I am getting syntax error for this as below:-

Code:

********************************* TOP OF DATA **********************************
 SYNCSORT FOR Z/OS  1.2.1.1N    U.S. PATENTS: 4210961, 5117495   (C) 2005 SYNCSO
                                                       z/OS   1.7.0
 PRODUCT LICENSED FOR CPU SERIAL NUMBER 5B5AE, MODEL 2084 305              LICEN
 SYSIN :
     SORT FIELDS=COPY
     OUTREC BUILD=(1,30,SQZ=(SHIFT=LEFT,
                        *
     PREBLANK=C'ABCDEFGHIJKLMNOPQRSTUVWXYZ'))
 WER268A  OUTREC STATEMENT  : SYNTAX ERROR
******************************** BOTTOM OF DATA ********************************
Back to top
View user's profile Send private message
murmohk1

Senior Member


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

PostPosted: Fri Sep 28, 2007 2:28 pm
Reply with quote

Quote:
WER268A OUTREC STATEMENT : SYNTAX ERROR

You are using SYNCSORT. But the solution provided is in dfsort.
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: Fri Sep 28, 2007 8:44 pm
Reply with quote

ajayvamsi,

The solution I provided works fine with DFSORT. But the WER messages indicate you're using Syncsort, not DFSORT. DFSORT has supported the SQZ function since April, 2006 - Syncsort doesn't support it.
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 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Access to non cataloged VSAM file JCL & VSAM 18
No new posts Compare only first records of the fil... SYNCSORT 7
Search our Forums:

Back to Top