Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Extract only numbers from input file records

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: Extract only numbers from input file records
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: 1439
Location: Bangalore,India

PostPosted: Thu Sep 27, 2007 7:27 pm    Post subject:
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

Site Director


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

PostPosted: Thu Sep 27, 2007 8:32 pm    Post subject:
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 Moderator


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

PostPosted: Thu Sep 27, 2007 9:40 pm    Post subject:
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: 1439
Location: Bangalore,India

PostPosted: Fri Sep 28, 2007 7:13 am    Post subject:
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

Senior Member


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

PostPosted: Fri Sep 28, 2007 2:17 pm    Post subject:
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
Currently Banned

New User


Joined: 21 Jul 2005
Posts: 56
Location: Hyderabad

PostPosted: Fri Sep 28, 2007 2:25 pm    Post subject:
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: 1439
Location: Bangalore,India

PostPosted: Fri Sep 28, 2007 2:28 pm    Post subject:
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 Moderator


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

PostPosted: Fri Sep 28, 2007 8:44 pm    Post subject:
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    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
This topic is locked: you cannot edit posts or make replies. Fetching data from BAI File arunsoods JCL & VSAM 1 Wed Jul 19, 2017 4:28 pm
No new posts Write out NODUPS but just from one file Jay Villaverde DFSORT/ICETOOL 8 Fri Jul 14, 2017 12:44 am
No new posts How to add header with Date(YYMMDD) i... Rajan Moorthy DFSORT/ICETOOL 2 Thu Jul 06, 2017 11:44 pm
No new posts How to generate a new unique Input fi... for1ranjith CLIST & REXX 11 Sat Jul 01, 2017 12:09 pm
No new posts Writing a file using online program grvtomar PL/I & Assembler 3 Fri Jun 30, 2017 1:06 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us